## test/java/lang/Math/Expm1Tests.java

```*** 23,36 ****

/*
* @test
* @bug 4851638 4900189 4939441
* @summary Tests for {Math, StrictMath}.expm1
* @author Joseph D. Darcy
*/

! import sun.misc.DoubleConsts;

/*
* The Taylor expansion of expxm1(x) = exp(x) -1 is
*
* 1 + x/1! + x^2/2! + x^3/3| + ... -1 =
--- 23,39 ----

/*
* @test
* @bug 4851638 4900189 4939441
* @summary Tests for {Math, StrictMath}.expm1
+  * @library /lib/testlibrary
+  * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+  * @run main Expm1Tests
* @author Joseph D. Darcy
*/

! import static jdk.testlibrary.DoubleUtils.*;

/*
* The Taylor expansion of expxm1(x) = exp(x) -1 is
*
* 1 + x/1! + x^2/2! + x^3/3| + ... -1 =
*** 78,88 ****
testCases[i][1], 0, null);
}

// For |x| < 2^-54 expm1(x) ~= x
!         for(int i = DoubleConsts.MIN_SUB_EXPONENT; i <= -54; i++) {
double d = Math.scalb(2, i);
failures += testExpm1Case(d, d);
failures += testExpm1Case(-d, -d);
}

--- 81,91 ----
testCases[i][1], 0, null);
}

// For |x| < 2^-54 expm1(x) ~= x
!         for(int i = MIN_SUB_EXPONENT; i <= -54; i++) {
double d = Math.scalb(2, i);
failures += testExpm1Case(d, d);
failures += testExpm1Case(-d, -d);
}

*** 97,107 ****
for(double d = 37.5; d <= 709.5; d += 1.0) {
failures += testExpm1CaseWithUlpDiff(d, StrictMath.exp(d), 2, null);
}

// For x > 710, expm1(x) should be infinity
!         for(int i = 10; i <= DoubleConsts.MAX_EXPONENT; i++) {
double d = Math.scalb(2, i);
failures += testExpm1Case(d, infinityD);
}

// By monotonicity, once the limit is reached, the
--- 100,110 ----
for(double d = 37.5; d <= 709.5; d += 1.0) {
failures += testExpm1CaseWithUlpDiff(d, StrictMath.exp(d), 2, null);
}

// For x > 710, expm1(x) should be infinity
!         for(int i = 10; i <= Double.MAX_EXPONENT; i++) {
double d = Math.scalb(2, i);
failures += testExpm1Case(d, infinityD);
}

// By monotonicity, once the limit is reached, the
*** 114,124 ****
for(double d = -36.75; d >= -127.75; d -= 1.0) {
failures += testExpm1CaseWithUlpDiff(d, -1.0, 1,
reachedLimit);
}

!         for(int i = 7; i <= DoubleConsts.MAX_EXPONENT; i++) {
double d = -Math.scalb(2, i);
failures += testExpm1CaseWithUlpDiff(d, -1.0, 1, reachedLimit);
}

// Test for monotonicity failures near multiples of log(2).
--- 117,127 ----
for(double d = -36.75; d >= -127.75; d -= 1.0) {
failures += testExpm1CaseWithUlpDiff(d, -1.0, 1,
reachedLimit);
}

!         for(int i = 7; i <= Double.MAX_EXPONENT; i++) {
double d = -Math.scalb(2, i);
failures += testExpm1CaseWithUlpDiff(d, -1.0, 1, reachedLimit);
}

// Test for monotonicity failures near multiples of log(2).
```