The java.lang.Math.getExponent() is a built-in math function which returns the unbiased exponent used in the representation of a float.
- If the argument is NaN or infinite, then the result is Float.MAX_EXPONENT + 1.
- If the argument is zero or subnormal, then the result is Float.MIN_EXPONENT -1.
Syntax:
public static int getExponent(float val) Parameter: val - a float value
Returns:
The method returns the unbiased exponent of the argument.
Example: To show working of java.lang.Math.getExponent() function
// Java program to demonstrate working // of java.lang.Math.getExponent() method import java.lang.Math; class Gfg { // driver code public static void main(String args[]) { float x = 7689.1f; float y = -794.99f; // print the unbiased exponent of them System.out.println(Math.getExponent(x)); System.out.println(Math.getExponent(y)); // print the unbiased exponent of 0 System.out.println(Math.getExponent(0)); } } |
Output:
12 9 -127
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
Recommended Posts:
- Java Math getExponent() method with Example
- StrictMath getExponent() Method In Java
- Java Math asin() method with Example
- Java Math log() method with example
- Java Math hypot() method with Example
- Java Math exp() method with Example
- Java Math expm1() method with Example
- Java Math round() method with Example
- Math pow() method in Java with Example
- Java Math nextAfter() method with Example
- Java.math.BigInteger.modInverse() method in Java
- Java.math.BigInteger.probablePrime() method in Java
- Java.lang.Math Class in Java | Set 1
- Java.lang.Math Class in Java | Set 2
- java.lang.Math.atan2() in Java
- Java Math random() method with Examples
- Java Math min() method with Examples
- Java Math max() method with Examples
- Math floorDiv() method in Java
- Java Math abs() method with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

