JavaScript log1p() method

Definition and usage

log1p() The method returns 1 + the natural logarithm of the specified number (base E).

Example

Returns 1 + the natural logarithm of different numbers (base E):

var a = Math.log1p(2.7183);
var b = Math.log1p(2);
var c = Math.log1p(1);
var d = Math.log1p(0);
var e = Math.log1p(-1);

Try it yourself

Syntax

Math.log1p(x)

Parameter value

Parameter Description
x Required. Number.

Technical details

Return value:

A number representing the natural logarithm of 1 + the specified number (base E)

  • If the number is -1, then return -Infinity
  • If the number is less than -1, then return NaN
JavaScript version: ECMAScript 2015

Webbläsartillämpning

Metoder Chrome Edge Firefox Safari Opera
log1p() 38.0 12.0 25.0 8.0 25.0

Relaterade sidor

Lärord:JavaScript matematik