Java Math.getExponent() method

21 Mar 2025 | 2 min read

The java.lang.Math.getExponent() return the unbiased exponent used in the representation of double or float.

Syntax

Parameter

Return

  • If the argument is positive or negative double or float value, this method will return the unbiased exponent.
  • If the argument is NaN or Infinity, this method will return Float.MAX_EXPONENT + 1 or Double.MAX_EXPONENT + 1.
  • If the argument is Zero, this method will return Float.MIN_EXPONENT - 1 or Double.MIN_EXPONENT - 1.

Example 1

Output:

 5 

Example 2

Output:

 6 

Example 3

Output:

 1024 

Example 4

Output:

 128 

Example 5

Output:

 -127 

Example 6

Output:

 -1023 
 
Next TopicJava Math