The java.lang.Math.nextDown() is a built-in math function in java which returns the floating-point value adjacent to the parameter provided in the direction of negative infinity.nextDown() implementation may run faster than its equivalent nextAfter() call. nextDown() 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 nextDown() :
- double type : nextDown(double d)
- float type : nextDown(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 negative infinity, the result is negative infinity.
public static dataType nextDown(dataType g) Parameter : g : an input for starting floating-point value. Return : The nextDown() method returns the adjacent floating-point value closer to negative infinity.
Example :To show working of java.lang.Math.nextDown() method.
23.439999999999998 28.099998 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 firstname.lastname@example.org. 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.
- LongStream.Builder add(long t) in Java
- LongStream.Builder accept() method in Java
- IntStream.Builder accept() method in Java
- PriorityBlockingQueue clear() method in Java
- PriorityBlockingQueue add() Method in Java
- Merge two sets in Java
- Understanding Classes and Objects in Java
- Initialization of local variable in a conditional block in Java
- IntStream.Builder build() in Java with Examples
- DoubleStream.Builder add(double t) in Java with Examples