Math.log()
Signature
double log (double a)
Description
Returns the natural logarithm (base e) of a double
value. Special 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.
A result must be within 1 ulp of the correctly rounded result. Results
must be semi-monotonic.
Parameters
Name | Type | Description |
a | double | A number greater than 0.0 . |
Returns
Type | Description |
double | The value ln a , the natural logarithm of a . |
Example
String result = String.valueOfDouble (Math.log (0.5));
Result is: result contains: "-0.6931471805599453"