nextDown()
is a built-in method of the java.lang.Math
library. It returns the value adjacent to the n
argument in the direction of negative infinity (-∞).
The example below is used for primitive double type argument:
static double nextDown(double n)
The example below is used for primitive float type argument:
static float nextDown(float n)
n
can be a double or float value.
This function returns the value adjacent to n
(double or float) in the direction of (-∞).
Double.MIN_VALUE
.Float.MIN_VALUE
.public class EdPresso { public static void main(String[] args) { double y = 0.0; // the argument is zero, the return value is Double.MIN_VALUE System.out.println(Math.nextDown(y)); y = 0.0/0; // the argument is NaN, the return value is NaN System.out.println(Math.nextDown(y)); y = 865.78; // the argument is of type double, the return value is the adjacent double value in the direction of negative infinity System.out.println(Math.nextDown(y)); y = -865.78; // the input of argument is zero, result: Float.MIN_VALUE System.out.println(Math.nextDown(y)); float x = 0.0f; // the argument is zero, the return value is Float.MIN_VALUE System.out.println(Math.nextDown(x)); } }
RELATED TAGS
CONTRIBUTOR
View all Courses