np.expm1
JavaScript | Math.expm1()方法 (JavaScript | Math.expm1() Method)
Math operations in JavaScript are handled using functions of math library in JavaScript. In this tutorial on Math.expm1() method, we will learn about the expm1() method and its working with examples.
JavaScript中的數學運算是使用JavaScript中的數學庫函數處理的。 在有關Math.expm1()方法的本教程中,我們將學習expm1()方法及其示例。
Math.expm1() is a function in math library of JavaScript that is used to support math's operation of ep-1 of a number p. Where, e is a mathematical constant with value 2.718.
Math.expm1()是JavaScript數學庫中的一個函數,用于支持數字p的e p -1的數學運算。 其中, e是一個數學常數,值為2.718 。
Syntax:
句法:
Math.expm1(p);
Parameter(s):
參數:
p – It takes only one value which is the number.
p –僅采用一個值即數字。
Return value:
返回值:
The return type of this method is number, it returns the result of the expression ep-1.
該方法的返回類型為number ,它返回表達式e p -1的結果。
Example 1:
范例1:
console.log(Math.expm1(0))
Output
輸出量
0
The value of e0 - 1 = 0
e 0-1 = 0的值
Example 2: printing valid results for the function
示例2:為該函數打印有效結果
console.log(Math.expm1(2))
console.log(Math.expm1(2.32))
console.log(Math.expm1(-5))
console.log(Math.expm1(Math.log10(43)))
Output
輸出量
6.38905609893065
9.175674306073333
-0.9932620530009145
4.121608017082989
Example 2: Tring values that will provide invalid results for the function.
示例2:Tring值將為該函數提供無效的結果。
console.log(Math.expm1(C))
/*Uncaught ReferenceError: C is not defined
at <anonymous>:1:24*/
console.log(Math.expm1("include help"))
/*NaN*/
翻譯自: https://www.includehelp.com/code-snippets/math-expm1-method-with-example-in-JavaScript.aspx
np.expm1