The java.lang.Math.nextUp() is a built-in math function in java which returns the floating-point value adjacent to the parameter provided in the direction of positive infinity.nextUp() method is overloaded which means that we have more than one method with the same name under the Math class.Two overloaded method of the nextUp() :
- double type : nextUp(double d)
- float type : nextUp(float f)
- If the argument is NaN, the result is NaN.
- If the argument is zero, the result is Double.MIN_VALUE if we are dealing with
double and if it’s float then the result is Float.MIN_VALUE.
- If the argument is positive infinity, the result is positive infinity.
public static dataType nextUp(dataType g) Parameter : g : an input for starting floating-point value. Return : The nextUp() method returns the adjacent floating-point value closer to positive infinity.
Example :To show working of java.lang.Math.nextUp() method.
69.19000000000001 78.100006 NaN 1.4E-45 Infinity
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- HashSet vs TreeSet in Java
- ShortBuffer allocate() method in Java With Examples
- IntBuffer duplicate() method in Java with Examples
- ShortBuffer compact() method in Java With Examples
- LongBuffer equals() method in Java
- IntBuffer array() method in Java
- IntBuffer hasArray() method in Java
- ShortBuffer arrayOffset() method in Java With Examples
- ShortBuffer asReadOnlyBuffer() method in Java with Examples
- ByteBuffer asDoubleBuffer() method in Java with Examples