StrictMath.getExponent(float): This method is available in java.lang.StrictMath class of Java.
Syntax:
int java.lang.StrictMath.getExponent(float f)
This method takes one argument of type float as its parameter. This method returns the unbiased exponent used in the representation of a float.
Special cases:
1. If the argument is NaN or infinite, then the result is Float.MAX_EXPONENT + 1.
2. If the argument is zero or subnormal, then the result is Float.MIN_EXPONENT -1.
Parameters: One parameter is required for this method.
f: a float value.
Returns: the unbiased exponent of the argument.
Exceptions: NA
Approach
Java
public class StrictMathgetExponentfloat {public static void main(String[] args) {float f = 35;System.out.println(StrictMath.getExponent(f));}}
Output:
5
No comments:
Post a Comment