- }
- hu &= 0x007fffff;
- /*
- * The approximation to sqrt(2) used in thresholds is not
- * critical. However, the ones used above must give less
- * strict bounds than the one here so that the k==0 case is
- * never reached from here, since here we have committed to
- * using the correction term but don't use it if k==0.
- */
- if (hu < 0x3504f4) { /* u < sqrt(2) */
- SET_FLOAT_WORD(u, hu|0x3f800000); /* normalize u */
- } else {
- k += 1;
- SET_FLOAT_WORD(u, hu|0x3f000000); /* normalize u/2 */
- hu = (0x00800000-hu)>>2;
- }
- f = u - 1.0f;
- }
- hfsq = 0.5f * f * f;
- if (hu == 0) { /* |f| < 2**-20 */
- if (f == 0.0f) {
- if (k == 0)
- return 0.0f;
- c += k*ln2_lo;
- return k*ln2_hi+c;
- }
- R = hfsq*(1.0f - 0.66666666666666666f * f);
- if (k == 0)
- return f - R;
- return k*ln2_hi - ((R-(k*ln2_lo+c))-f);
+ /* reduce u into [sqrt(2)/2, sqrt(2)] */
+ iu = (iu&0x007fffff) + 0x3f3504f3;
+ u.i = iu;
+ f = u.f - 1;