changeset 6297:3e48cbd4b0aa

Re-enable HP_series : add a tolerance to the double compare
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 28 Aug 2012 12:22:06 +0200
parents 89ed4e8c45c4
children 02d0c44df163
files graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_series.java
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_series.java	Mon Aug 27 14:50:03 2012 +0200
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_series.java	Tue Aug 28 12:22:06 2012 +0200
@@ -98,10 +98,15 @@
         return (0.0);
     }
 
-    // TODO (ds) disabled as JDK 7u6 + Graal breaks this for some as yet unknown reason)
-    //@Test
+    /* This test is sensible to the implementation of Math.pow, cos and sin.
+     * Since for these functions, the specs says "The computed result must be within 1 ulp of the exact result",
+     * different implementation may return different results.
+     * The 11 ulp delta allowed for test(100) tries to account for that but is not guaranteed to work forever.
+     */
+    @Test
     public void run0() throws Throwable {
-        Assert.assertEquals(0.6248571921291398d, test(100), 0);
+        double expected = 0.6248571921291398d;
+        Assert.assertEquals(expected, test(100), 11 * Math.ulp(expected));
     }
 
 }