StrictMath.nextUp(float): This method is available in java.lang.StrictMath class of Java.
Syntax:
float java.lang.StrictMath.nextUp(float f)
This method takes one argument of type float as its parameter. This method returns the floating-point value adjacent to f in the direction of positive infinity.
Note:
1. If the argument is NaN, the result is NaN
2. If the argument is positive infinity, the result is positive infinity.
3. If the argument is zero, the result is Float.MIN_VALUE
Parameters: One parameter is required for this method.
f: starting floating-point value.
Returns: The adjacent floating-point value closer to positive infinity.
Exceptions: NA
Approach
Java
public class StrictMathnextUpfloat {public static void main(String[] args) {float f = 19.78f;System.out.println(StrictMath.nextUp(f));}}
Output:
19.780003
No comments:
Post a Comment