src/share/classes/java/lang/StrictMath.java

Print this page
rev 7994 : 8010430: Math.round has surprising behavior for odd values of ulp 1
Summary: If the effective floating point exponent is zero return the significand including the implicit 1-bit.
Reviewed-by: bpb, darcy, gls
Contributed-by: Dmitry Nadezhin <dmitry.nadezhin@oracle.com>

*** 631,641 **** */ public static native double pow(double a, double b); /** * Returns the closest {@code int} to the argument, with ties ! * rounding up. * * <p>Special cases: * <ul><li>If the argument is NaN, the result is 0. * <li>If the argument is negative infinity or any value less than or * equal to the value of {@code Integer.MIN_VALUE}, the result is --- 631,641 ---- */ public static native double pow(double a, double b); /** * Returns the closest {@code int} to the argument, with ties ! * rounding to positive infinity. * * <p>Special cases: * <ul><li>If the argument is NaN, the result is 0. * <li>If the argument is negative infinity or any value less than or * equal to the value of {@code Integer.MIN_VALUE}, the result is
*** 654,664 **** return Math.round(a); } /** * Returns the closest {@code long} to the argument, with ties ! * rounding up. * * <p>Special cases: * <ul><li>If the argument is NaN, the result is 0. * <li>If the argument is negative infinity or any value less than or * equal to the value of {@code Long.MIN_VALUE}, the result is --- 654,664 ---- return Math.round(a); } /** * Returns the closest {@code long} to the argument, with ties ! * rounding to positive infinity. * * <p>Special cases: * <ul><li>If the argument is NaN, the result is 0. * <li>If the argument is negative infinity or any value less than or * equal to the value of {@code Long.MIN_VALUE}, the result is