1 /* origin: FreeBSD /usr/src/lib/msun/src/e_acosl.c */
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 * Developed at SunSoft, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
10 * ====================================================
13 * See comments in acos.c.
14 * Converted to long double by David Schultz <das@FreeBSD.ORG>.
19 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
20 long double acosl(long double x
)
24 #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
25 #include "__invtrigl.h"
26 #if LDBL_MANT_DIG == 64
27 #define CLEARBOTTOM(u) (u.i.m &= -1ULL << 32)
28 #elif LDBL_MANT_DIG == 113
29 #define CLEARBOTTOM(u) (u.i.lo = 0)
32 long double acosl(long double x
)
34 union ldshape u
= {x
};
35 long double z
, s
, c
, f
;
36 uint16_t e
= u
.i
.se
& 0x7fff;
43 return 2*pio2_hi
+ 0x1p
-120f
;
48 if (e
< 0x3fff - LDBL_MANT_DIG
- 1)
49 return pio2_hi
+ 0x1p
-120f
;
50 return pio2_hi
- (__invtrigl_R(x
*x
)*x
- pio2_lo
+ x
);
56 return 2*(pio2_hi
- (__invtrigl_R(z
)*s
- pio2_lo
+ s
));
64 c
= (z
- f
*f
)/(s
+ f
);
65 return 2*(__invtrigl_R(z
)*s
+ c
+ f
);