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

Print this page

        

*** 1395,1404 **** --- 1395,1462 ---- public static float nextUp(float f) { return Math.nextUp(f); } /** + * Returns the floating-point value adjacent to {@code d} in + * the direction of negative infinity. This method is + * semantically equivalent to {@code nextAfter(d, + * Double.NEGATIVE_INFINITY)}; however, a + * {@code nextDown} implementation may run faster than its + * equivalent {@code nextAfter} call. + * + * <p>Special Cases: + * <ul> + * <li> If the argument is NaN, the result is NaN. + * + * <li> If the argument is negative infinity, the result is + * negative infinity. + * + * <li> If the argument is zero, the result is + * {@code -Double.MIN_VALUE} + * + * </ul> + * + * @param d starting floating-point value + * @return The adjacent floating-point value closer to negative + * infinity. + * @since 1.8 + */ + public static double nextDown(double d) { + return Math.nextDown(d); + } + + /** + * Returns the floating-point value adjacent to {@code f} in + * the direction of negative infinity. This method is + * semantically equivalent to {@code nextAfter(f, + * Float.NEGATIVE_INFINITY)}; however, a + * {@code nextDown} implementation may run faster than its + * equivalent {@code nextAfter} call. + * + * <p>Special Cases: + * <ul> + * <li> If the argument is NaN, the result is NaN. + * + * <li> If the argument is negative infinity, the result is + * negative infinity. + * + * <li> If the argument is zero, the result is + * {@code -Float.MIN_VALUE} + * + * </ul> + * + * @param f starting floating-point value + * @return The adjacent floating-point value closer to negative + * infinity. + * @since 1.8 + */ + public static float nextDown(float f) { + return Math.nextDown(f); + } + + /** * Return {@code d} &times; * 2<sup>{@code scaleFactor}</sup> rounded as if performed * by a single correctly rounded floating-point multiply to a * member of the double value set. See the Java * Language Specification for a discussion of floating-point