335 if (((ix - 0x3ff00000) | y_is_int) == 0) { 336 z = (z-z)/(z-z); // (-1)**non-int is NaN 337 } else if (y_is_int == 1) 338 z = -1.0 * z; // (x < 0)**odd = -(|x|**odd) 339 } 340 return z; 341 } 342 343 n = (hx >> 31) + 1; 344 345 // (x < 0)**(non-int) is NaN 346 if ((n | y_is_int) == 0) 347 return (x-x)/(x-x); 348 349 s = 1.0; // s (sign of result -ve**odd) = -1 else = 1 350 if ( (n | (y_is_int - 1)) == 0) 351 s = -1.0; // (-ve)**(odd int) 352 353 double p_h, p_l, t1, t2; 354 // |y| is huge 355 if (y_abs > 0x1.0p31) { // if |y| > 2**31 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 358 final double INV_LN2_L = 0x1.4ae0_bf85_ddf44p-26; // 1.92596299112661746887e-08 = 1/ln2 tail 359 360 // Over/underflow if x is not close to one 361 if (x_abs < 0x1.fffffp-1) // |x| < 0.9999995231628418 362 return (y < 0.0) ? s * INFINITY : s * 0.0; 363 if (x_abs > 1.0) // |x| > 1.0 364 return (y > 0.0) ? s * INFINITY : s * 0.0; 365 /* 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 368 */ 369 t = x_abs - 1.0; // t has 20 trailing zeros 370 w = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25)); 371 u = INV_LN2_H * t; // INV_LN2_H has 21 sig. bits 372 v = t * INV_LN2_L - w * INV_LN2; 373 t1 = u + v; 374 t1 =__LO(t1, 0); 375 t2 = v - (t1 - u); 376 } else { 377 final double CP = 0x1.ec70_9dc3_a03fdp-1; // 9.61796693925975554329e-01 = 2/(3ln2) 378 final double CP_H = 0x1.ec709ep-1; // 9.61796700954437255859e-01 = (float)cp 379 final double CP_L = -0x1.e2fe_0145_b01f5p-28; // -7.02846165095275826516e-09 = tail of CP_H 380 381 double z_h, z_l, ss, s2, s_h, s_l, t_h, t_l; 382 n = 0; 383 // Take care of subnormal numbers | 335 if (((ix - 0x3ff00000) | y_is_int) == 0) { 336 z = (z-z)/(z-z); // (-1)**non-int is NaN 337 } else if (y_is_int == 1) 338 z = -1.0 * z; // (x < 0)**odd = -(|x|**odd) 339 } 340 return z; 341 } 342 343 n = (hx >> 31) + 1; 344 345 // (x < 0)**(non-int) is NaN 346 if ((n | y_is_int) == 0) 347 return (x-x)/(x-x); 348 349 s = 1.0; // s (sign of result -ve**odd) = -1 else = 1 350 if ( (n | (y_is_int - 1)) == 0) 351 s = -1.0; // (-ve)**(odd int) 352 353 double p_h, p_l, t1, t2; 354 // |y| is huge 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 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 359 360 // Over/underflow if x is not close to one 361 if (x_abs < 0x1.fffff_0000_0000p-1) // |x| < ~0.9999995231628418 362 return (y < 0.0) ? s * INFINITY : s * 0.0; 363 if (x_abs > 0x1.00000_ffff_ffffp0) // |x| > ~1.0 364 return (y > 0.0) ? s * INFINITY : s * 0.0; 365 /* 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 368 */ 369 t = x_abs - 1.0; // t has 20 trailing zeros 370 w = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25)); 371 u = INV_LN2_H * t; // INV_LN2_H has 21 sig. bits 372 v = t * INV_LN2_L - w * INV_LN2; 373 t1 = u + v; 374 t1 =__LO(t1, 0); 375 t2 = v - (t1 - u); 376 } else { 377 final double CP = 0x1.ec70_9dc3_a03fdp-1; // 9.61796693925975554329e-01 = 2/(3ln2) 378 final double CP_H = 0x1.ec709ep-1; // 9.61796700954437255859e-01 = (float)cp 379 final double CP_L = -0x1.e2fe_0145_b01f5p-28; // -7.02846165095275826516e-09 = tail of CP_H 380 381 double z_h, z_l, ss, s2, s_h, s_l, t_h, t_l; 382 n = 0; 383 // Take care of subnormal numbers |