- if (expt < BIAS - 1) { /* |x| < 0.5 */
- if (expt < ACOS_CONST)
- return pio2_hi + pio2_lo; /* x tiny: acosl=pi/2 */
- z = x * x;
- p = P(z);
- q = Q(z);
- r = p / q;
- return pio2_hi - (x - (pio2_lo - x * r));
- } else if (expsign < 0) { /* x < -0.5 */
- z = (one + x) * 0.5;
- p = P(z);
- q = Q(z);
- s = sqrtl(z);
- r = p / q;
- w = r * s - pio2_lo;
- return pi - 2.0 * (s + w);
- } else { /* x > 0.5 */
- z = (one - x) * 0.5;
+ /* |x| < 0.5 */
+ if (expt < 0x3fff - 1) {
+ if (expt < 0x3fff - 65)
+ return pio2_hi + 0x1p-120f; /* x < 0x1p-65: acosl(x)=pi/2 */
+ return pio2_hi - (x - (pio2_lo - x * __invtrigl_R(x*x)));
+ }
+ /* x < -0.5 */
+ if (expsign < 0) {
+ z = (1.0 + x) * 0.5;