- Math
- Methods
- Math.abs()
- Math.acos()
- Math.acosh()
- Math.asin()
- Math.asinh()
- Math.atan()
- Math.atan2()
- Math.atanh()
- Math.cbrt()
- Math.ceil()
- Math.cos()
- Math.cosh()
- Math.exp()
- Math.expm1()
- Math.floor()
- Math.fround()
- Math.hypot()
- Math.imul()
- Math.log()
- Math.log10()
- Math.log1p()
- Math.log2()
- Math.max()
- Math.min()
- Math.pow()
- Math.random()
- Math.round()
- Math.sign()
- Math.sin()
- Math.sinh()
- Math.sqrt()
- Math.tan()
- Math.tanh()
- Math.trunc()
- Properties
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
Mathobject it belongs to.
Mozilla Developer Network