diff options
author | Elliott Hughes <enh@google.com> | 2014-10-25 23:32:07 -0700 |
---|---|---|
committer | Unsuk Jung <unsuk@google.com> | 2014-10-28 17:03:20 +0000 |
commit | 9ed62cd1e87a433130a089f8cf27de560c643c8a (patch) | |
tree | 558f5681248ee2645a6569e71fd5098d1c47457a /harmony-tests | |
parent | 3f8d941d89f5dd8fff2d6faf705f1841d40c683e (diff) | |
download | libcore-9ed62cd1e87a433130a089f8cf27de560c643c8a.zip libcore-9ed62cd1e87a433130a089f8cf27de560c643c8a.tar.gz libcore-9ed62cd1e87a433130a089f8cf27de560c643c8a.tar.bz2 |
Allow 1 ulp difference in test_cbrt_D and test_sinh_D.
Bug: 18016320
(cherry picked from commit cf5f86467f5be5f1c3ae2a5518c65f496ac93e33)
Change-Id: I05c3810320d035323e5fec07712b47586eb100bb
(cherry picked from commit 8afb381342e073b3bfcc8700b370e381ac23b2e0)
Diffstat (limited to 'harmony-tests')
-rw-r--r-- | harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/MathTest.java | 84 |
1 files changed, 30 insertions, 54 deletions
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/MathTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/MathTest.java index cd38545..ed8e2b5 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/MathTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/MathTest.java @@ -120,34 +120,22 @@ public class MathTest extends junit.framework.TestCase { */ public void test_cbrt_D() { //Test for special situations - assertTrue("Should return Double.NaN", Double.isNaN(Math - .cbrt(Double.NaN))); - assertEquals("Should return Double.POSITIVE_INFINITY", - Double.POSITIVE_INFINITY, Math - .cbrt(Double.POSITIVE_INFINITY), 0D); - assertEquals("Should return Double.NEGATIVE_INFINITY", - Double.NEGATIVE_INFINITY, Math - .cbrt(Double.NEGATIVE_INFINITY), 0D); - assertEquals(Double.doubleToLongBits(0.0), Double.doubleToLongBits(Math - .cbrt(0.0))); - assertEquals(Double.doubleToLongBits(+0.0), Double.doubleToLongBits(Math - .cbrt(+0.0))); - assertEquals(Double.doubleToLongBits(-0.0), Double.doubleToLongBits(Math - .cbrt(-0.0))); - - assertEquals("Should return 3.0", 3.0, Math.cbrt(27.0), 0D); - assertEquals("Should return 23.111993172558684", 23.111993172558684, - Math.cbrt(12345.6), 0D); - assertEquals("Should return 5.643803094122362E102", - 5.643803094122362E102, Math.cbrt(Double.MAX_VALUE), 0D); - assertEquals("Should return 0.01", 0.01, Math.cbrt(0.000001), 0D); - - assertEquals("Should return -3.0", -3.0, Math.cbrt(-27.0), 0D); - assertEquals("Should return -23.111993172558684", -23.111993172558684, - Math.cbrt(-12345.6), 0D); - assertEquals("Should return 1.7031839360032603E-108", - 1.7031839360032603E-108, Math.cbrt(Double.MIN_VALUE), 0D); - assertEquals("Should return -0.01", -0.01, Math.cbrt(-0.000001), 0D); + assertTrue(Double.isNaN(Math.cbrt(Double.NaN))); + assertEquals(Double.POSITIVE_INFINITY, Math.cbrt(Double.POSITIVE_INFINITY), 0D); + assertEquals(Double.NEGATIVE_INFINITY, Math.cbrt(Double.NEGATIVE_INFINITY), 0D); + assertEquals(Double.doubleToLongBits(0.0), Double.doubleToLongBits(Math.cbrt(0.0))); + assertEquals(Double.doubleToLongBits(+0.0), Double.doubleToLongBits(Math.cbrt(+0.0))); + assertEquals(Double.doubleToLongBits(-0.0), Double.doubleToLongBits(Math.cbrt(-0.0))); + + assertEquals(3.0, Math.cbrt(27.0), 0D); + assertEquals(23.111993172558684, Math.cbrt(12345.6), Math.ulp(23.111993172558684)); + assertEquals(5.643803094122362E102, Math.cbrt(Double.MAX_VALUE), 0D); + assertEquals(0.01, Math.cbrt(0.000001), 0D); + + assertEquals(-3.0, Math.cbrt(-27.0), 0D); + assertEquals(-23.111993172558684, Math.cbrt(-12345.6), Math.ulp(-23.111993172558684)); + assertEquals(1.7031839360032603E-108, Math.cbrt(Double.MIN_VALUE), 0D); + assertEquals(-0.01, Math.cbrt(-0.000001), 0D); } /** @@ -1703,32 +1691,20 @@ public class MathTest extends junit.framework.TestCase { */ public void test_sinh_D() { // Test for special situations - assertTrue("Should return NaN", Double.isNaN(Math.sinh(Double.NaN))); - assertEquals("Should return POSITIVE_INFINITY", - Double.POSITIVE_INFINITY, Math.sinh(Double.POSITIVE_INFINITY), 0D); - assertEquals("Should return NEGATIVE_INFINITY", - Double.NEGATIVE_INFINITY, Math.sinh(Double.NEGATIVE_INFINITY), 0D); - assertEquals(Double.doubleToLongBits(0.0), Double.doubleToLongBits(Math - .sinh(0.0))); - assertEquals(Double.doubleToLongBits(+0.0), Double - .doubleToLongBits(Math.sinh(+0.0))); - assertEquals(Double.doubleToLongBits(-0.0), Double - .doubleToLongBits(Math.sinh(-0.0))); - - assertEquals("Should return POSITIVE_INFINITY", - Double.POSITIVE_INFINITY, Math.sinh(1234.56), 0D); - assertEquals("Should return NEGATIVE_INFINITY", - Double.NEGATIVE_INFINITY, Math.sinh(-1234.56), 0D); - assertEquals("Should return 1.0000000000001666E-6", - 1.0000000000001666E-6, Math.sinh(0.000001), 0D); - assertEquals("Should return -1.0000000000001666E-6", - -1.0000000000001666E-6, Math.sinh(-0.000001), 0D); - assertEquals("Should return 5.115386441963859", 5.115386441963859, Math - .sinh(2.33482), 0D); - assertEquals("Should return POSITIVE_INFINITY", - Double.POSITIVE_INFINITY, Math.sinh(Double.MAX_VALUE), 0D); - assertEquals("Should return 4.9E-324", 4.9E-324, Math - .sinh(Double.MIN_VALUE), 0D); + assertTrue(Double.isNaN(Math.sinh(Double.NaN))); + assertEquals(Double.POSITIVE_INFINITY, Math.sinh(Double.POSITIVE_INFINITY), 0D); + assertEquals(Double.NEGATIVE_INFINITY, Math.sinh(Double.NEGATIVE_INFINITY), 0D); + assertEquals(Double.doubleToLongBits(0.0), Double.doubleToLongBits(Math.sinh(0.0))); + assertEquals(Double.doubleToLongBits(+0.0), Double.doubleToLongBits(Math.sinh(+0.0))); + assertEquals(Double.doubleToLongBits(-0.0), Double.doubleToLongBits(Math.sinh(-0.0))); + + assertEquals(Double.POSITIVE_INFINITY, Math.sinh(1234.56), 0D); + assertEquals(Double.NEGATIVE_INFINITY, Math.sinh(-1234.56), 0D); + assertEquals(1.0000000000001666E-6, Math.sinh(0.000001), 0D); + assertEquals(-1.0000000000001666E-6, Math.sinh(-0.000001), 0D); + assertEquals(5.115386441963859, Math.sinh(2.33482), Math.ulp(5.115386441963859)); + assertEquals(Double.POSITIVE_INFINITY, Math.sinh(Double.MAX_VALUE), 0D); + assertEquals(4.9E-324, Math.sinh(Double.MIN_VALUE), 0D); } /** |