350 if ( (n | (y_is_int - 1)) == 0) |
350 if ( (n | (y_is_int - 1)) == 0) |
351 s = -1.0; // (-ve)**(odd int) |
351 s = -1.0; // (-ve)**(odd int) |
352 |
352 |
353 double p_h, p_l, t1, t2; |
353 double p_h, p_l, t1, t2; |
354 // |y| is huge |
354 // |y| is huge |
355 if (y_abs > 0x1.0p31) { // if |y| > 2**31 |
355 if (y_abs > 0x1.00000_ffff_ffffp31) { // if |y| > ~2**31 |
356 final double INV_LN2 = 0x1.7154_7652_b82fep0; // 1.44269504088896338700e+00 = 1/ln2 |
356 final double INV_LN2 = 0x1.7154_7652_b82fep0; // 1.44269504088896338700e+00 = 1/ln2 |
357 final double INV_LN2_H = 0x1.715476p0; // 1.44269502162933349609e+00 = 24 bits of 1/ln2 |
357 final double INV_LN2_H = 0x1.715476p0; // 1.44269502162933349609e+00 = 24 bits of 1/ln2 |
358 final double INV_LN2_L = 0x1.4ae0_bf85_ddf44p-26; // 1.92596299112661746887e-08 = 1/ln2 tail |
358 final double INV_LN2_L = 0x1.4ae0_bf85_ddf44p-26; // 1.92596299112661746887e-08 = 1/ln2 tail |
359 |
359 |
360 // Over/underflow if x is not close to one |
360 // Over/underflow if x is not close to one |
361 if (x_abs < 0x1.fffffp-1) // |x| < 0.9999995231628418 |
361 if (x_abs < 0x1.fffff_0000_0000p-1) // |x| < ~0.9999995231628418 |
362 return (y < 0.0) ? s * INFINITY : s * 0.0; |
362 return (y < 0.0) ? s * INFINITY : s * 0.0; |
363 if (x_abs > 1.0) // |x| > 1.0 |
363 if (x_abs > 0x1.00000_ffff_ffffp0) // |x| > ~1.0 |
364 return (y > 0.0) ? s * INFINITY : s * 0.0; |
364 return (y > 0.0) ? s * INFINITY : s * 0.0; |
365 /* |
365 /* |
366 * now |1-x| is tiny <= 2**-20, sufficient to compute |
366 * now |1-x| is tiny <= 2**-20, sufficient to compute |
367 * log(x) by x - x^2/2 + x^3/3 - x^4/4 |
367 * log(x) by x - x^2/2 + x^3/3 - x^4/4 |
368 */ |
368 */ |