Math
is a built-in object in JavaScript that contains different methods and properties used to perform mathematical operations. It contains the expm1()
function, which is used to compute e raised to the power of a specified number - 1.
Math.expm1(param);
param
: This is the input value of type Number
for which we want to find the expm1()
.
Number
in JavaScript is a 64-bit double-precision value which is the same asdouble
in C# or Java.
Number
: It returns e
^param
- 1 where param
is the input value. It is of type Number
.
Infinity
: The function returns this if input param
is equal to Infinity
.
e
is called the Euler number, and has a value of approximately 2.71828.
console.log("expm1(-1) = " + Math.expm1(-1));console.log("expm1(0) = " + Math.expm1(0));console.log("expm1(∞) = " + Math.expm1(Infinity));console.log("expm1(2) = " + Math.expm1(2));console.log("expm1(-2) = " + Math.expm1(-2));console.log("expm1(e) = " + Math.expm1(Math.E));console.log("expm1(1) = " + Math.expm1(1));