# HG changeset patch # User Jaroslav Tulach # Date 1359529791 -3600 # Node ID 146b81b14ac60701436da0ff130bcf8db4f896df # Parent 3fcc279c921bec3e1a8e746f4a5d392b8fc305e1# Parent 3223b1897b717c811355bf62a2c9f9b717de11b9 Merge with default to make sure emulation of IEEEremainder is on the emul branch diff -r 3fcc279c921b -r 146b81b14ac6 emul/mini/src/main/java/java/lang/Math.java --- a/emul/mini/src/main/java/java/lang/Math.java Mon Jan 28 18:15:21 2013 +0100 +++ b/emul/mini/src/main/java/java/lang/Math.java Wed Jan 30 08:09:51 2013 +0100 @@ -397,9 +397,9 @@ * @return the remainder when {@code f1} is divided by * {@code f2}. */ -// public static double IEEEremainder(double f1, double f2) { -// return f1 % f2; -// } + public static double IEEEremainder(double f1, double f2) { + return f1 - (f2 * Math.round(f1 / f2)); + } /** * Returns the {@code double} value that is closest in value diff -r 3fcc279c921b -r 146b81b14ac6 vm/src/test/java/org/apidesign/vm4brwsr/StaticMethodTest.java --- a/vm/src/test/java/org/apidesign/vm4brwsr/StaticMethodTest.java Mon Jan 28 18:15:21 2013 +0100 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/StaticMethodTest.java Wed Jan 30 08:09:51 2013 +0100 @@ -146,6 +146,22 @@ ); } + @Test public void ieeeReminder1() throws Exception { + assertExec( + "Same result 1", + Math.class, "IEEEremainder__DDD", + Math.IEEEremainder(10.0, 4.5), 10.0, 4.5 + ); + } + + @Test public void ieeeReminder2() throws Exception { + assertExec( + "Same result 1", + Math.class, "IEEEremainder__DDD", + Math.IEEEremainder(Integer.MAX_VALUE, -4.5), Integer.MAX_VALUE, -4.5 + ); + } + @Test public void divAndRound() throws Exception { assertExec( "Should be rounded to one",