StrictMath getExponent() Method In Java
- The getExponent(double num) is an inbuilt method of StrictMath class which is used to get the unbiased exponent to be used in the representation of a given double argument. It gives rise to two special results:
- The result will be Double.MAX_EXPONENT + 1 when the given argument is NaN or infinite
- The result is Double.MIN_EXPONENT – 1 when the argument is zero.
Syntax :
public static int getExponent(double num)
Parameters: The method accepts one parameter num of double type whose unbiased exponent is supposed to be found.
Return Value: The method returns the unbiased exponent which used in the representation of the given double argument.
Examples:
Input: num = 75.45 Output: 6.0 Input: num = 0.0 Output: -1023.0
Below program illustrates the java.lang.StrictMath.getExponent() method:
// Java praogram to illustrate the// java.lang.StrictMath.getExponent()importjava.lang.*;publicclassGeeks {publicstaticvoidmain(String[] args){doublevalue =93.5;/* Here it returns the unbiased exponent whichis used in the representation of a double*/doubleexp_Value = StrictMath.getExponent(value);System.out.print("Exponent of "+ value +" = ");System.out.println(exp_Value);}}chevron_rightfilter_noneOutput:Exponent of 93.5 = 6.0
- The getExponent(float num) is an inbuilt method of StrictMath class which is used to get an unbiased exponent, to be used in the representation of a given float argument. It gives rise to two special results:
- The result will be Float.MAX_EXPONENT + 1 when the given argument is NaN or infinite
- The result is Float.MIN_EXPONENT – 1 when the argument is zero.
Syntax :
public static int getExponent(float num)
Parameters: This method accepts one parameter num which is of float type whose unbiased exponent we want to find.
Return Value: The method returns the unbiased exponent which used in the representation of the given float argument.
Examples:
Input: num = 10254.25f Output: 13.0 Input: num = 10.25f Output: 3.0
Below program illustrate the java.lang.StrictMath.getExponent() method:
// Java praogram to illustrate the// java.lang.StrictMath.getExponent()importjava.lang.*;publicclassGeeks {publicstaticvoidmain(String[] args){floatvalue =10254.25f;/* Here it returns the unbiased exponent whichis used in the representation of a float*/doubleexp_Value = StrictMath.getExponent(value);System.out.print("Exponent of "+ value +" = ");System.out.println(exp_Value);}}chevron_rightfilter_noneOutput:Exponent of 10254.25 = 13.0
Recommended Posts:
- Java Math getExponent() method with Example
- Java Math getExponent() method with Example
- StrictMath exp() Method in Java
- StrictMath tan() Method in Java
- StrictMath pow() Method in Java
- StrictMath log() Method In Java
- StrictMath sin() Method in Java
- StrictMath random() Method in Java
- StrictMath fma() method in Java with Examples
- StrictMath nextDown() Method in Java
- StrictMath round() method in Java
- StrictMath rint() Method in Java
- StrictMath hypot() Method in Java
- StrictMath ulp() Method In Java with Examples
- StrictMath tanh() Method in Java
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.

