Math.exp()
Math.exp() 静态方法返回 e 的数字幂。那是
¥The Math.exp() static method returns e raised to the power of a number. That is
Try it
语法
参数
返回值
¥Return value
代表 ex 的非负数,其中 e 为 自然对数的底。
¥A nonnegative number representing ex, where e is the base of the natural logarithm.
描述
¥Description
因为 exp() 是 Math 的静态方法,所以你始终将其用作 Math.exp(),而不是用作你创建的 Math 对象的方法(Math 不是构造函数)。
¥Because exp() is a static method of Math, you always use it as Math.exp(), rather than as a method of a Math object you created (Math is not a constructor).
请注意,非常接近 0 的数的 e 次方将非常接近 1,并且会导致精度损失。在这种情况下,你可能想改用 Math.expm1,并获得精度更高的答案小数部分。
¥Beware that e to the power of a number very close to 0 will be very close to 1 and suffer from loss of precision. In this case, you may want to use Math.expm1 instead, and obtain a much higher-precision fractional part of the answer.
示例
使用 Math.exp()
规范
| Specification |
|---|
| ECMAScript Language Specification # sec-math.exp |
浏览器兼容性
BCD tables only load in the browser