63
Java Math.log() method
The java.lang.Math.log() is used to find out the Logarithmic Value of any number. This method returns the natural logarithm (base e) of a double value as a parameter.
Syntax
Parameter
Return
- If the argument is Positive value, this method will return the logarithm of a given value.
- If the argument is Negative value, this method will return NaN.
- If the argument is not a number (NaN), this method will return NaN.
- If the argument is Positive Infinity, this method will return Positive Infinity.
- If the argument is positive or negative Zero, this method will return Negative Infinity.
Example 1
Output:
3.6609942506244004
Example 2
Output:
NaN
Example 3
Output:
Infinity
Example 4
Output:
-Infinity
Next TopicJava Math