equal
deleted
inserted
replaced
264 // subsequent terms of the Taylor series expansion will get |
264 // subsequent terms of the Taylor series expansion will get |
265 // rounded away since |n-n^3| > 53, the binary precision of a |
265 // rounded away since |n-n^3| > 53, the binary precision of a |
266 // double significand. |
266 // double significand. |
267 |
267 |
268 for(int i = DoubleConsts.MIN_SUB_EXPONENT; i < -27; i++) { |
268 for(int i = DoubleConsts.MIN_SUB_EXPONENT; i < -27; i++) { |
269 double d = FpUtils.scalb(2.0, i); |
269 double d = Math.scalb(2.0, i); |
270 |
270 |
271 // Result and expected are the same. |
271 // Result and expected are the same. |
272 failures += testSinhCaseWithUlpDiff(d, d, 2.5); |
272 failures += testSinhCaseWithUlpDiff(d, d, 2.5); |
273 } |
273 } |
274 |
274 |
342 } |
342 } |
343 |
343 |
344 // sinh(x) overflows for values greater than 710; in |
344 // sinh(x) overflows for values greater than 710; in |
345 // particular, it overflows for all 2^i, i > 10. |
345 // particular, it overflows for all 2^i, i > 10. |
346 for(int i = 10; i <= DoubleConsts.MAX_EXPONENT; i++) { |
346 for(int i = 10; i <= DoubleConsts.MAX_EXPONENT; i++) { |
347 double d = FpUtils.scalb(2.0, i); |
347 double d = Math.scalb(2.0, i); |
348 |
348 |
349 // Result and expected are the same. |
349 // Result and expected are the same. |
350 failures += testSinhCaseWithUlpDiff(d, |
350 failures += testSinhCaseWithUlpDiff(d, |
351 Double.POSITIVE_INFINITY, 0.0); |
351 Double.POSITIVE_INFINITY, 0.0); |
352 } |
352 } |
623 // For powers of 2 less than 2^(-27), the second and |
623 // For powers of 2 less than 2^(-27), the second and |
624 // subsequent terms of the Taylor series expansion will get |
624 // subsequent terms of the Taylor series expansion will get |
625 // rounded. |
625 // rounded. |
626 |
626 |
627 for(int i = DoubleConsts.MIN_SUB_EXPONENT; i < -27; i++) { |
627 for(int i = DoubleConsts.MIN_SUB_EXPONENT; i < -27; i++) { |
628 double d = FpUtils.scalb(2.0, i); |
628 double d = Math.scalb(2.0, i); |
629 |
629 |
630 // Result and expected are the same. |
630 // Result and expected are the same. |
631 failures += testCoshCaseWithUlpDiff(d, 1.0, 2.5); |
631 failures += testCoshCaseWithUlpDiff(d, 1.0, 2.5); |
632 } |
632 } |
633 |
633 |
701 } |
701 } |
702 |
702 |
703 // cosh(x) overflows for values greater than 710; in |
703 // cosh(x) overflows for values greater than 710; in |
704 // particular, it overflows for all 2^i, i > 10. |
704 // particular, it overflows for all 2^i, i > 10. |
705 for(int i = 10; i <= DoubleConsts.MAX_EXPONENT; i++) { |
705 for(int i = 10; i <= DoubleConsts.MAX_EXPONENT; i++) { |
706 double d = FpUtils.scalb(2.0, i); |
706 double d = Math.scalb(2.0, i); |
707 |
707 |
708 // Result and expected are the same. |
708 // Result and expected are the same. |
709 failures += testCoshCaseWithUlpDiff(d, |
709 failures += testCoshCaseWithUlpDiff(d, |
710 Double.POSITIVE_INFINITY, 0.0); |
710 Double.POSITIVE_INFINITY, 0.0); |
711 } |
711 } |
982 // subsequent terms of the Taylor series expansion will get |
982 // subsequent terms of the Taylor series expansion will get |
983 // rounded away since |n-n^3| > 53, the binary precision of a |
983 // rounded away since |n-n^3| > 53, the binary precision of a |
984 // double significand. |
984 // double significand. |
985 |
985 |
986 for(int i = DoubleConsts.MIN_SUB_EXPONENT; i < -27; i++) { |
986 for(int i = DoubleConsts.MIN_SUB_EXPONENT; i < -27; i++) { |
987 double d = FpUtils.scalb(2.0, i); |
987 double d = Math.scalb(2.0, i); |
988 |
988 |
989 // Result and expected are the same. |
989 // Result and expected are the same. |
990 failures += testTanhCaseWithUlpDiff(d, d, 2.5); |
990 failures += testTanhCaseWithUlpDiff(d, d, 2.5); |
991 } |
991 } |
992 |
992 |
996 for(int i = 22; i < 32; i++) { |
996 for(int i = 22; i < 32; i++) { |
997 failures += testTanhCaseWithUlpDiff(i, 1.0, 2.5); |
997 failures += testTanhCaseWithUlpDiff(i, 1.0, 2.5); |
998 } |
998 } |
999 |
999 |
1000 for(int i = 5; i <= DoubleConsts.MAX_EXPONENT; i++) { |
1000 for(int i = 5; i <= DoubleConsts.MAX_EXPONENT; i++) { |
1001 double d = FpUtils.scalb(2.0, i); |
1001 double d = Math.scalb(2.0, i); |
1002 |
1002 |
1003 failures += testTanhCaseWithUlpDiff(d, 1.0, 2.5); |
1003 failures += testTanhCaseWithUlpDiff(d, 1.0, 2.5); |
1004 } |
1004 } |
1005 |
1005 |
1006 return failures; |
1006 return failures; |