src/share/classes/java/lang/Float.java
Print this page
*** 457,467 ****
*
* @param v the value to be tested.
* @return {@code true} if the argument is NaN;
* {@code false} otherwise.
*/
! static public boolean isNaN(float v) {
return (v != v);
}
/**
* Returns {@code true} if the specified number is infinitely
--- 457,467 ----
*
* @param v the value to be tested.
* @return {@code true} if the argument is NaN;
* {@code false} otherwise.
*/
! public static boolean isNaN(float v) {
return (v != v);
}
/**
* Returns {@code true} if the specified number is infinitely
*** 469,482 ****
*
* @param v the value to be tested.
* @return {@code true} if the argument is positive infinity or
* negative infinity; {@code false} otherwise.
*/
! static public boolean isInfinite(float v) {
return (v == POSITIVE_INFINITY) || (v == NEGATIVE_INFINITY);
}
/**
* The value of the Float.
*
* @serial
*/
--- 469,497 ----
*
* @param v the value to be tested.
* @return {@code true} if the argument is positive infinity or
* negative infinity; {@code false} otherwise.
*/
! public static boolean isInfinite(float v) {
return (v == POSITIVE_INFINITY) || (v == NEGATIVE_INFINITY);
}
+
+ /**
+ * Returns {@code true} if the argument is a finite floating-point
+ * value; returns {@code false} otherwise (for NaN and infinity
+ * arguments).
+ *
+ * @param f the {@code float} value to be tested
+ * @return {@code true} if the argument is a finite
+ * floating-point value, {@code false} otherwise.
+ * @since 1.8
+ */
+ public static boolean isFinite(float f) {
+ return Math.abs(f) <= FloatConsts.MAX_VALUE;
+ }
+
/**
* The value of the Float.
*
* @serial
*/