VOOZH about

URL: https://www.geeksforgeeks.org/java/strictmath-nextdown-method-in-java/

⇱ StrictMath nextDown() Method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

StrictMath nextDown() Method in Java

Last Updated : 11 Jul, 2025

nextDown(double num)

The nextDown(double num) is the inbuilt method of StrictMath class in Java which is used to get the floating point value that is adjacent to num in the direction of negative infinity. The result is NaN when argument is a NaN. It returns negative infinity when the num is negative infinity. The result is Double.MIN_VALUE when the argument is zero. The nextDown() method is equivalent to nextAfter(num, Double.NEGATIVE_INFINITY) but nextDown() runs faster than its equivalent nextAfter call. 

Syntax: 

public static double nextDown(double num)

Parameters: The method accepts one parameter num of double type which is the starting floating point value.

Return Value: The method returns the adjacent floating-point value closer to negative infinity.

Examples : 

Input: num = 7.16
Output: 7.159999999999999

Below programs illustrate the nextDown() Method:

Program 1: 


Output: 
The Next down value of 62.9 = 62.89999999999999
The Next down value of 16.6226 = 16.622599999999995
The Next down value of 0.0 = -4.9E-324

 

nextDown(float num)

The nextDown(float num) is the inbuilt method of StrictMath class in Java which is used to get the floating point value that is adjacent to num in the direction of negative infinity. The result is NaN when argument is a NaN. It returns negative infinity when the num is negative infinity. The result is Float.MIN_VALUE when the argument is zero. The nextDown() method is equivalent to nextAfter(num, Float.NEGATIVE_INFINITY) but nextDown() runs faster than its equivalent nextAfter call.

Syntax: 

public static float nextDown(float num)

Parameters: The method accepts one parameter num of float type which is the starting floating point value.

Return Value: The method returns the adjacent floating-point value closer to negative infinity.

Examples : 

Input: num = 1.2f
Output: 1.1999999

Below programs illustrate the Java.lang.StrictMath.nextDown() Method:

Program 1: 


Output: 
The Next down value of 16.622 = 16.621998
The Next down value of 91.11 = 91.10999
The Next down value of 0.0 = -1.4E-45

 
Comment