StrictMath.getExponent(double) in Java

StrictMath.getExponent(double): This method is available in java.lang.StrictMath class of Java.

Syntax:

int java.lang.StrictMath.getExponent(double d)

This method takes one argument of type double as its parameter. This method returns the unbiased exponent used in the representation of a double.

Special cases:

1. If the argument is NaN or infinite, then the result is Double.MAX_EXPONENT + 1.

2. If the argument is zero or subnormal, then the result is Double.MIN_EXPONENT -1.

Parameters: One parameter is required for this method.

d: a double value.

Returns: the unbiased exponent of the argument.

Exceptions: NA

Approach

Java

public class StrictMathgetExponentdouble {
    public static void main(String[] args) {

        double d = 19;
        System.out.println(StrictMath.getExponent(d));
    }
}

Output:

4


No comments:

Post a Comment