StrictMath.log() in Java

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

Syntax:

double java.lang.StrictMath.log(double a)

This method takes one argument of type double as its parameter. This method returns the natural logarithm (base e) of a double value.

Special cases:

1. If the argument is NaN or less than zero, then the result is NaN.

2. If the argument is positive infinity, then the result is positive infinity.

3. If the argument is positive zero or negative zero, then the result is negative infinity.

Parameters: One parameter is required for this method.

a: a value.

Returns: the value ln a the natural logarithm of a.

Exceptions: NA

Approach

Java

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

        double a = 178;
        System.out.println(StrictMath.log(a));
    }
}

Output:

5.181783550292085


No comments:

Post a Comment