Math.log

Returns the natural logarithm (base E) of a number.

Method of Math
Static

Syntax

log( x )

Parameters

Parameter Description
x A number

Description

If the value of number is negative, the return value is always NaN.
Because log is a static method of Math, you always use it as Math.log(), rather than as a method of a Math object you created.

Examples

The following function returns the natural log of the variable x:

If you pass getLog the value 10, it returns 2.302585092994046; if you pass it the value 0, it returns -Infinity; if you pass it the value -1, it returns NaN because -1 is out of range.

See also

Math.exp, Math.pow

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.