# Java.lang.StrictMath.log() Method

## Description

The java.lang.StrictMath.log() method returns the natural logarithm (base e) of a double value.It include some cases −

• If the argument is NaN or less than zero, then the result is NaN.
• If the argument is positive infinity, then the result is positive infinity.
• If the argument is positive zero or negative zero, then the result is negative infinity.

## Declaration

Following is the declaration for java.lang.StrictMath.log() method

```public static double log(double a)
```

## Parameters

a − This is the value.

## Return Value

This method returns the value ln a i.e natural logarithm of a.

NA

## Example

The following example shows the usage of java.lang.StrictMath.log() method.

```package com.tutorialspoint;

import java.lang.*;

public class StrictMathDemo {

public static void main(String[] args) {

double d1 = 10 , d2 = 0.0 , d3 = (1.0/0.0), d4 = 1.0;

// returns natural logarithm(base e) of a double value
double logValue = StrictMath.log(d1);
System.out.println("Log value of " + d1 + " = " + logValue);

logValue = StrictMath.log(d2);
System.out.println("Log value of " + d2 + " = " + logValue);

logValue = StrictMath.log(d3);
System.out.println("Log value of " + d3 + " = " + logValue);

logValue = StrictMath.log(d4);
System.out.println("Log value of " + d4 + " = " + logValue);
}
}
```

Let us compile and run the above program, this will produce the following result −

```Log value of 10.0 = 2.302585092994046
Log value of 0.0 = -Infinity
Log value of Infinity = Infinity
Log value of 1.0 = 0.0
```
java_lang_strictmath.htm