Javatpoint Logo
Javatpoint Logo

Java Math.nextUp() Method

  • The java.lang.Math.nextUp() is a inbuilt math method in java. It returns the floating-point value adjacent to the user specified parameter (d) in the direction of positive infinity. This method is equivalent to nextAfter(d, Double.POSITIVE_INFINITY) method.
  • Implementation of nextUp 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 Positive Infinity, this method will return Positive Infinity.

Example 1

Test it Now

Output:

NaN

Example 2

Test it Now

Output:

744.9300000000001

Example 3

Test it Now

Output:

328.70004

Example 4

Test it Now

Output:

1.4E-45

Example 5

Test it Now

Output:

4.9E-324

Next TopicJava Math




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA