Merge with default to make sure emulation of IEEEremainder is on the emul branch emul
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Wed, 30 Jan 2013 08:09:51 +0100
branchemul
changeset 606146b81b14ac6
parent 604 3fcc279c921b
parent 605 3223b1897b71
child 608 6e9328ca3462
Merge with default to make sure emulation of IEEEremainder is on the emul branch
     1.1 --- a/emul/mini/src/main/java/java/lang/Math.java	Mon Jan 28 18:15:21 2013 +0100
     1.2 +++ b/emul/mini/src/main/java/java/lang/Math.java	Wed Jan 30 08:09:51 2013 +0100
     1.3 @@ -397,9 +397,9 @@
     1.4       * @return  the remainder when {@code f1} is divided by
     1.5       *          {@code f2}.
     1.6       */
     1.7 -//    public static double IEEEremainder(double f1, double f2) {
     1.8 -//        return f1 % f2;
     1.9 -//    }
    1.10 +    public static double IEEEremainder(double f1, double f2) {
    1.11 +        return f1 - (f2 * Math.round(f1 / f2));
    1.12 +    }
    1.13  
    1.14      /**
    1.15       * Returns the {@code double} value that is closest in value
     2.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/StaticMethodTest.java	Mon Jan 28 18:15:21 2013 +0100
     2.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/StaticMethodTest.java	Wed Jan 30 08:09:51 2013 +0100
     2.3 @@ -146,6 +146,22 @@
     2.4          );
     2.5      }
     2.6  
     2.7 +    @Test public void ieeeReminder1() throws Exception {
     2.8 +        assertExec(
     2.9 +            "Same result 1",
    2.10 +            Math.class, "IEEEremainder__DDD", 
    2.11 +            Math.IEEEremainder(10.0, 4.5), 10.0, 4.5
    2.12 +        );
    2.13 +    }
    2.14 +
    2.15 +    @Test public void ieeeReminder2() throws Exception {
    2.16 +        assertExec(
    2.17 +            "Same result 1",
    2.18 +            Math.class, "IEEEremainder__DDD", 
    2.19 +            Math.IEEEremainder(Integer.MAX_VALUE, -4.5), Integer.MAX_VALUE, -4.5
    2.20 +        );
    2.21 +    }
    2.22 +
    2.23      @Test public void divAndRound() throws Exception {
    2.24          assertExec(
    2.25              "Should be rounded to one",