Math.log1p()

Did you know that you can read content offline by using one of these tools? If you would like to read offline MDN content in another format, let us know by commenting on Bug 665750.

Dash App

This is an experimental technology, part of the Harmony (EcmaScript 6) proposal.
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future version of browsers as the spec changes.

Summary

The Math.log1p() function returns the natural logarithm (base E) of 1 + a number.

Syntax

Math.log1p(x)

Parameters

x
A number.

Description

If the value of number is less than -1, the return value is always NaN.

Because log1p is a static method of Math, you always use it as Math.log1p(), rather than as a method of a Math object you created (Math is not a constructor).

Examples

Example: Using Math.log1p

Math.log1p(1)  // 0.6931471805599453
Math.log1p(0)  // 0
Math.log1p(-1) // -Infinity
Math.log1p(-2) // NaN

Specifications

Specification Status Comment
ECMAScript Language Specification 6th Edition (ECMA-262) Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support Not supported 25.0 (25) Not supported Not supported Not supported
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support Not supported Not supported 25.0 (25) Not supported Not supported Not supported

See also

  • The Math object it belongs to.

Tags (4)