Home » Java Math.nextDown() method with Examples

Java Math.nextDown() method with Examples

by Online Tutorials Library

Java Math.nextDown() method

The java.lang.Math.nextDown() is a built-in math method in java. It returns the floating-point value adjacent to the user specified parameter (d) in the direction of negative infinity. This method is equivalent to nextAfter(d, Double.NEGATIVE_INFINITY) method.

Implementation of nextDown 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 Negative Infinity, this method will return Negative Infinity.

Example 1

Test it Now

Output:

NaN  

Example 2

Test it Now

Output:

744.9299999999998  

Example 3

Test it Now

Output:

328.69998  

Example 4

Test it Now

Output:

-1.4E-45  

Example 5

Test it Now

Output:

-4.9E-324  

Example 6

Test it Now

Output:

-Infinity  

Next TopicJava Math

You may also like