vm/src/test/java/org/apidesign/vm4brwsr/StaticMethodTest.java
brancharithmetic
changeset 677 1ff540c1650f
parent 582 8e546d108658
parent 605 3223b1897b71
child 708 59d5596a9c6c
     1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/StaticMethodTest.java	Fri Jan 25 11:00:52 2013 +0100
     1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/StaticMethodTest.java	Tue Feb 05 17:04:22 2013 +0100
     1.3 @@ -78,6 +78,89 @@
     1.4              3.0d, 1l
     1.5          );
     1.6      }
     1.7 +    
     1.8 +    @Test public void rintNegativeUp() throws Exception {
     1.9 +        final double cnts = -453904.634;
    1.10 +        assertExec(
    1.11 +            "Should round up to end with 5",
    1.12 +            Math.class, "rint__DD", 
    1.13 +            -453905.0, cnts
    1.14 +        );
    1.15 +    }
    1.16 +
    1.17 +    @Test public void rintNegativeDown() throws Exception {
    1.18 +        final double cnts = -453904.434;
    1.19 +        assertExec(
    1.20 +            "Should round up to end with 4",
    1.21 +            Math.class, "rint__DD", 
    1.22 +            -453904.0, cnts
    1.23 +        );
    1.24 +    }
    1.25 +
    1.26 +    @Test public void rintPositiveUp() throws Exception {
    1.27 +        final double cnts = 453904.634;
    1.28 +        assertExec(
    1.29 +            "Should round up to end with 5",
    1.30 +            Math.class, "rint__DD", 
    1.31 +            453905.0, cnts
    1.32 +        );
    1.33 +    }
    1.34 +    @Test public void rintPositiveDown() throws Exception {
    1.35 +        final double cnts = 453904.434;
    1.36 +        assertExec(
    1.37 +            "Should round up to end with 4",
    1.38 +            Math.class, "rint__DD", 
    1.39 +            453904.0, cnts
    1.40 +        );
    1.41 +    }
    1.42 +    @Test public void rintOneHalf() throws Exception {
    1.43 +        final double cnts = 1.5;
    1.44 +        assertExec(
    1.45 +            "Should round up to end with 2",
    1.46 +            Math.class, "rint__DD", 
    1.47 +            2.0, cnts
    1.48 +        );
    1.49 +    }
    1.50 +    @Test public void rintNegativeOneHalf() throws Exception {
    1.51 +        final double cnts = -1.5;
    1.52 +        assertExec(
    1.53 +            "Should round up to end with 2",
    1.54 +            Math.class, "rint__DD", 
    1.55 +            -2.0, cnts
    1.56 +        );
    1.57 +    }
    1.58 +    @Test public void rintTwoAndHalf() throws Exception {
    1.59 +        final double cnts = 2.5;
    1.60 +        assertExec(
    1.61 +            "Should round up to end with 2",
    1.62 +            Math.class, "rint__DD", 
    1.63 +            2.0, cnts
    1.64 +        );
    1.65 +    }
    1.66 +    @Test public void rintNegativeTwoOneHalf() throws Exception {
    1.67 +        final double cnts = -2.5;
    1.68 +        assertExec(
    1.69 +            "Should round up to end with 2",
    1.70 +            Math.class, "rint__DD", 
    1.71 +            -2.0, cnts
    1.72 +        );
    1.73 +    }
    1.74 +
    1.75 +    @Test public void ieeeReminder1() throws Exception {
    1.76 +        assertExec(
    1.77 +            "Same result 1",
    1.78 +            Math.class, "IEEEremainder__DDD", 
    1.79 +            Math.IEEEremainder(10.0, 4.5), 10.0, 4.5
    1.80 +        );
    1.81 +    }
    1.82 +
    1.83 +    @Test public void ieeeReminder2() throws Exception {
    1.84 +        assertExec(
    1.85 +            "Same result 1",
    1.86 +            Math.class, "IEEEremainder__DDD", 
    1.87 +            Math.IEEEremainder(Integer.MAX_VALUE, -4.5), Integer.MAX_VALUE, -4.5
    1.88 +        );
    1.89 +    }
    1.90  
    1.91      @Test public void divAndRound() throws Exception {
    1.92          assertExec(