You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// public static double nextAfter(double start, double direction)
// public static float nextAfter(float start, float direction)
// public static double nextUp(double start) {
// return nextAfter(start, 1.0d);
// }
// public static float nextUp(float start) {
// return nextAfter(start,1.0f);
// }
The addition of Double.doubleToLongBits/longBitsToDouble and Float.floatToIntBits/intBitsToFloat appears to overcome the browser limitations indicated.
Note that this comment block is misleading - nextUp should pass INFINITY values as the "direction" parameter according to the javadoc - passing 1.0 and -1.0 will result in incorrect values even in the JVM impl.
Historically these were deliberately omitted, but were added in Java 6:
gwt/user/super/com/google/gwt/emul/java/lang/Math.java
Lines 35 to 42 in aabb575
The addition of
Double.doubleToLongBits
/longBitsToDouble
andFloat.floatToIntBits
/intBitsToFloat
appears to overcome the browser limitations indicated.Note that this comment block is misleading - nextUp should pass INFINITY values as the "direction" parameter according to the javadoc - passing 1.0 and -1.0 will result in incorrect values even in the JVM impl.
Java 8 added the nextDown method as well.
These links are only for the double variants, but each has a float overload as well:
https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextAfter-double-double-
https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextUp-double-
https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextDown-double-
The text was updated successfully, but these errors were encountered: