src/share/classes/java/lang/Float.java

Print this page

        

*** 924,931 **** --- 924,970 ---- return (thisBits == anotherBits ? 0 : // Values are equal (thisBits < anotherBits ? -1 : // (-0.0, 0.0) or (!NaN, NaN) 1)); // (0.0, -0.0) or (NaN, !NaN) } + /** + * Adds two {@code float} values together as per the + operator. + * + * @param a the first operand + * @param b the second operand + * @return the sum of {@code a} and {@code b} + * @see java.util.function.BinaryOperator + * @since 1.8 + */ + public static float sum(float a, float b) { + return a + b; + } + + /** + * Returns the greater of two {@code float} values. + * + * @param a the first operand + * @param b the second operand + * @return the larger of {@code a} and {@code b} + * @see java.util.function.BinaryOperator + * @since 1.8 + */ + public static float max(float a, float b) { + return Math.max(a, b); + } + + /** + * Returns the lesser of two {@code float} values. + * + * @param a the first operand + * @param b the second operand + * @return the lesser of {@code a} and {@code b} + * @see java.util.function.BinaryOperator + * @since 1.8 + */ + public static float min(float a, float b) { + return Math.min(a, b); + } + /** use serialVersionUID from JDK 1.0.2 for interoperability */ private static final long serialVersionUID = -2671257302660747028L; }