JavaScript expm1() method

Definition and usage

expm1() the method returns Ex the value minus 1, where E is the Euler number(approximately 2.7183),x is the number passed to it.

This method is more than using Math.exp() and subtract 1 for more accuracy.

Example

Example 1

Calculate the exponential value of a number - 1:

Math.expm1(3);

Try it yourself

Example 2

Use expm1() method for different numbers:

var a = Math.exp(1);
var b = Math.exp(-1);
var c = Math.exp(5);
var d = Math.exp(10);

Try it yourself

Syntax

Math.expm1(x)

Parameter value

Parameter Description
x Required. Number.

Technical details

Return value: Number, representing Ex - 1.
JavaScript version: ECMAScript 2015

Webbläsarstöd

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

Relaterade sidor

Lär dig:JavaScript matematik