Java Math.nextUp() Method
- The java.lang.Math.nextUp() is a inbuilt math method in java. It returns the floating-point value adjacent to the user specified parameter (d) in the direction of positive infinity. This method is equivalent to nextAfter(d, Double.POSITIVE_INFINITY) method.
- Implementation of nextUp may run faster than its equivalent nextAfter call.
Syntax:
Parameter
Return:
- If the argument is a NaN, this method will return NaN.
- If the argument is Zero and we are dealing with double, this method will return Double.MIN_VALUE.
- If the argument is zero and we are dealing with float, this method will return Float.MIN_VALUE.
- If the argument is Positive Infinity, this method will return Positive Infinity.
Example 1
Test it Now
Output:
Example 2
Test it Now
Output:
Example 3
Test it Now
Output:
Example 4
Test it Now
Output:
Example 5
Test it Now
Output:
|