- union IEEEl2bits u;
- long double z, p, q, r, w, s, c, df;
- int16_t expsign, expt;
- u.e = x;
- expsign = u.xbits.expsign;
- expt = expsign & 0x7fff;
- if (expt >= BIAS) { /* |x| >= 1 */
- if (expt == BIAS &&
- ((u.bits.manh & ~LDBL_NBIT) | u.bits.manl) == 0) {
- if (expsign > 0)
- return 0.0; /* acos(1) = 0 */
- else
- return pi + 2.0 * pio2_lo; /* acos(-1)= pi */
- }
- return (x - x) / (x - x); /* acos(|x|>1) is NaN */
+ union ldshape u = {x};
+ long double z, s, c, f;
+ uint16_t e = u.i.se & 0x7fff;
+
+ /* |x| >= 1 or nan */
+ if (e >= 0x3fff) {
+ if (x == 1)
+ return 0;
+ if (x == -1)
+ return 2*pio2_hi + 0x1p-120f;
+ return 0/(x-x);