8375285: Addressed the reviewer's comments.

This commit is contained in:
Anton Artemov 2026-01-26 12:45:24 +01:00
parent dbfce1c9b9
commit 24a7b7ca11
4 changed files with 20 additions and 13 deletions

View File

@ -3537,24 +3537,24 @@ final class FdLibm {
private static final double huge = 1.0e300;
static double compute(double x) {
double t,w;
int hx,ix;
double t, w;
int hx, ix;
hx = __HI(x);
ix = hx&0x7fffffff;
ix = hx & 0x7fffffff;
if(ix >= 0x7ff00000) {
return x + x; /* x is inf or NaN */
return x + x; // x is inf or NaN
}
if(ix < 0x3e300000) { /* |x| < 2**-28 */
if(ix < 0x3e300000) { // |x| < 2**-28
if(huge + x > 1.0) {
return x; /* return x inexact except 0 */
return x; // return x inexact except 0
}
}
if(ix > 0x41b00000) { /* |x| > 2**28 */
if(ix > 0x41b00000) { // |x| > 2**28
w = Log.compute(Math.abs(x)) + ln2;
} else if (ix > 0x40000000) { /* 2**28 > |x| > 2.0 */
} else if (ix > 0x40000000) { // 2**28 > |x| > 2.0
t = Math.abs(x);
w = Log.compute(2.0 * t + 1.0 / (Sqrt.compute(x * x + 1.0) + t));
} else { /* 2.0 > |x| > 2**-28 */
} else { // 2.0 > |x| > 2**-28
t = x * x;
w = Log1p.compute(Math.abs(x) + t / (1.0 + Sqrt.compute(1.0 + t)));
}

View File

@ -2770,10 +2770,14 @@ public final class Math {
* same sign as the argument.
*
* <li>If the argument is positive infinity, then the result is
* positive infinity
* positive infinity.
*
* <li>If the argument is negative infinity, then the result is
* negative infinity
* negative infinity.
*
* <li>If the argument is NaN, then the result is NaN.
*
* <p>The computed result must be within 2.5 ulps of the exact result.
*
* </ul>
* @param x The number whose inverse hyperbolic sine is to be returned.

View File

@ -76,7 +76,8 @@ import jdk.internal.vm.annotation.IntrinsicCandidate;
* {@code exp}, {@code log}, {@code log10},
* {@code cbrt}, {@code atan2}, {@code pow},
* {@code sinh}, {@code cosh}, {@code tanh},
* {@code hypot}, {@code expm1}, and {@code log1p}.
* {@code asinh}, {@code hypot}, {@code expm1},
* and {@code log1p}.
*
* <p>
* The platform uses signed two's complement integer arithmetic with
@ -2187,6 +2188,8 @@ public final class StrictMath {
* <li>If the argument is negative infinity, then the result is
* negative infinity
*
* <li>If the argument is NaN, then the result is NaN.
*
* </ul>
* @param x The number whose inverse hyperbolic sine is to be returned.
* @return The inverse hyperbolic sine of {@code x}.

View File

@ -1573,7 +1573,7 @@ public class HyperbolicTests {
double d = Math.scalb(2.0, i);
// Result and expected are the same.
failures += testAsinhCaseWithUlpDiff(d, d, 2.5);
failures += testAsinhCaseWithUlpDiff(d, d, 3.0);
}
failures += testAsinhAdditionalTests();