Java Math nextDown() Method

Facebooktwitterredditpinterestlinkedinmailby feather

The nextDown() method of Math class returns the floating-point number adjacent to the argument in direction of the negative infinity.

Syntax:

  1. public static double nextDown (double d)
  2. public static float nextDown (float f)

Parameters:

The parameters ‘d’ and ‘f’ represent the starting floating-point values.

Return Value:

The nextDown () method returns the floating-point number which is closer to negative infinity.

Special cases of the nextDown() method are as follows:

  • It returns NaN, is the argument passed is NaN.
  • It returns negative infinity, if the argument is negative infinity.
  • It returns –Double.MIN_VALUE, is the argument is zero.

Example 1:

Output:

Example 2:

Output:

Example 3:

Output:

Example 4:

Output:

Example 5:

Output:

Facebooktwitterredditpinterestlinkedinmailby feather