# HG changeset patch # User Gilles Duboscq # Date 1346149326 -7200 # Node ID 3e48cbd4b0aa30a88d59825306039e95cdc35199 # Parent 89ed4e8c45c4f1edbae800557dc010729ef5fd9a Re-enable HP_series : add a tolerance to the double compare diff -r 89ed4e8c45c4 -r 3e48cbd4b0aa graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_series.java --- 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)); } }