This JavaScript tutorial explains how to use the math function called expm1() with syntax and examples.
Description
In JavaScript, expm1() is a function that is used to return e raised to the energy of wide variety minus 1 (which is enumber – 1). Because the expm1() function is a static characteristic of the Math object, it have to be invoked via the placeholder object called Math.
Syntax
In JavaScript, the syntax for the expm1() feature is:
Math.expm1(number);
Parameters or Arguments
number The variety used as the exponent in enumber – 1 the place e is the base of herbal logarithms.
Returns
The expm1() feature returns enumber – 1 where e is the base of natural logarithms and number is the exponent used in the calculation. The mathematical constant e has an approximate cost of 2.71828.
Note
Math is a placeholder object that consists of mathematical features and constants of which expm1() is one of these functions.
Example
Let’s take a seem at an example of how to use the expm1() feature in JavaScript.
For example:
console.log(Math.expm1(0));
console.log(Math.expm1(1));
console.log(Math.expm1(-2));
In this example, we have invoked the expm1() characteristic the usage of the Math class.
We have written the output of the expm1() characteristic to the net browser console log, for demonstration purposes, to exhibit what the expm1() characteristic returns.
The following will be output to the net browser console log:
0
1.718281828459045
-0.8646647167633873
In this example, the first output to the console log back 1 which is the calculation of e0 – 1.
The 2d output to the console log again 1.718281828459045 which is the calculation of e1 – 1.
The 0.33 output to the console log back -0.8646647167633873 which is the calculation of e-2 – 1.
Leave a Review