JavaScript Tutorial JavaScript References

JavaScript - Math.expm1() Method



The JavaScript Math.expm1() method returns e raised to the power of specified number minus 1, i.e., ex-1. Please note that e is the base of the natural system of logarithms, and its value is approximately 2.718281828459045.

Syntax

Math.expm1(x)

Parameters

x Specify the exponent of e.

Return Value

Returns e raised to the power of specified number minus 1, i.e., ex-1.

Example:

In the example below, Math.expm1() method is used to calculate e raised to the power of specified number minus one.

var txt;

txt = "Math.expm1(2) = " + Math.expm1(2) + "<br>";
txt = txt + "Math.expm1(-2) = " + Math.expm1(-2) + "<br>";
txt = txt + "Math.expm1(1.5) = " + Math.expm1(1.5) + "<br>";
txt = txt + "Math.expm1(-1.5) = " + Math.expm1(-1.5) + "<br>";

The output (value of txt) after running above script will be:

Math.expm1(2) = 6.38905609893065
Math.expm1(-2) = -0.8646647167633873
Math.expm1(1.5) = 3.481689070338065
Math.expm1(-1.5) = -0.7768698398515702

❮ JavaScript - Math Object