Math.log()

Signature

double log (double a)

Domain

action, condition

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

NameTypeDescription
adoubleA number greater than 0.0.

Returns

TypeDescription
doubleThe value ln a, the natural logarithm of a.

Cautions

none

Example


String result = String.valueOfDouble (Math.log (0.5));

Result is: result contains: "-0.6931471805599453"