Home » Java Math.getExponent() Method with Examples

Java Math.getExponent() Method with Examples

by Online Tutorials Library

Java Math.getExponent() method

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

Test it Now

Output:

5  

Example 2

Test it Now

Output:

6  

Example 3

Test it Now

Output:

1024  

Example 4

Test it Now

Output:

128  

Example 5

Test it Now

Output:

-127  

Example 6

Test it Now

Output:

-1023  

Next TopicJava Math

You may also like