test/java/lang/Math/Expm1Tests.java

Print this page

        

*** 80,90 **** } // For |x| < 2^-54 expm1(x) ~= x for(int i = DoubleConsts.MIN_SUB_EXPONENT; i <= -54; i++) { ! double d = FpUtils.scalb(2, i); failures += testExpm1Case(d, d); failures += testExpm1Case(-d, -d); } --- 80,90 ---- } // 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); }
*** 99,109 **** 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 = FpUtils.scalb(2, i); failures += testExpm1Case(d, infinityD); } // By monotonicity, once the limit is reached, the // implemenation should return the limit for all smaller --- 99,109 ---- 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 // implemenation should return the limit for all smaller
*** 116,126 **** failures += testExpm1CaseWithUlpDiff(d, -1.0, 1, reachedLimit); } for(int i = 7; i <= DoubleConsts.MAX_EXPONENT; i++) { ! double d = -FpUtils.scalb(2, i); failures += testExpm1CaseWithUlpDiff(d, -1.0, 1, reachedLimit); } // Test for monotonicity failures near multiples of log(2). // Test two numbers before and two numbers after each chosen --- 116,126 ---- 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). // Test two numbers before and two numbers after each chosen
*** 143,154 **** double pc = StrictMath.log(2)*i; pcNeighbors[2] = pc; pcNeighbors[1] = FpUtils.nextDown(pc); pcNeighbors[0] = FpUtils.nextDown(pcNeighbors[1]); ! pcNeighbors[3] = FpUtils.nextUp(pc); ! pcNeighbors[4] = FpUtils.nextUp(pcNeighbors[3]); for(int j = 0; j < pcNeighbors.length; j++) { pcNeighborsExpm1[j] = Math.expm1(pcNeighbors[j]); pcNeighborsStrictExpm1[j] = StrictMath.expm1(pcNeighbors[j]); } --- 143,154 ---- double pc = StrictMath.log(2)*i; pcNeighbors[2] = pc; pcNeighbors[1] = FpUtils.nextDown(pc); pcNeighbors[0] = FpUtils.nextDown(pcNeighbors[1]); ! pcNeighbors[3] = Math.nextUp(pc); ! pcNeighbors[4] = Math.nextUp(pcNeighbors[3]); for(int j = 0; j < pcNeighbors.length; j++) { pcNeighborsExpm1[j] = Math.expm1(pcNeighbors[j]); pcNeighborsStrictExpm1[j] = StrictMath.expm1(pcNeighbors[j]); }