Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: fusl/src/math/coshl.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fusl/src/math/coshf.c ('k') | fusl/src/math/cosl.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "libm.h"
2
3 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
4 long double coshl(long double x)
5 {
6 return cosh(x);
7 }
8 #elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384
9 long double coshl(long double x)
10 {
11 union ldshape u = {x};
12 unsigned ex = u.i.se & 0x7fff;
13 uint32_t w;
14 long double t;
15
16 /* |x| */
17 u.i.se = ex;
18 x = u.f;
19 w = u.i.m >> 32;
20
21 /* |x| < log(2) */
22 if (ex < 0x3fff-1 || (ex == 0x3fff-1 && w < 0xb17217f7)) {
23 if (ex < 0x3fff-32) {
24 FORCE_EVAL(x + 0x1p120f);
25 return 1;
26 }
27 t = expm1l(x);
28 return 1 + t*t/(2*(1+t));
29 }
30
31 /* |x| < log(LDBL_MAX) */
32 if (ex < 0x3fff+13 || (ex == 0x3fff+13 && w < 0xb17217f7)) {
33 t = expl(x);
34 return 0.5*(t + 1/t);
35 }
36
37 /* |x| > log(LDBL_MAX) or nan */
38 t = expl(0.5*x);
39 return 0.5*t*t;
40 }
41 #elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
42 // TODO: broken implementation to make things compile
43 long double coshl(long double x)
44 {
45 return cosh(x);
46 }
47 #endif
OLDNEW
« no previous file with comments | « fusl/src/math/coshf.c ('k') | fusl/src/math/cosl.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698