Math.exp()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Math.exp()
は静的メソッドで、 e のある数値のべき乗を返します。
試してみましょう
console.log(Math.exp(0));
// Expected output: 1
console.log(Math.exp(1));
// Expected output: 2.718281828459 (approximately)
console.log(Math.exp(-1));
// Expected output: 0.36787944117144233
console.log(Math.exp(2));
// Expected output: 7.38905609893065
構文
js
Math.exp(x)
引数
x
-
数値です。
返値
ex を表す非負の数で、 e は自然対数の底です。
解説
exp()
は Math
の静的メソッドであるため、生成した Math
オブジェクトのメソッドとしてではなく、常に Math.exp()
として使用するようにしてください (Math
はコンストラクターではありません)。
e
のべき乗が 0 に非常に近い値の場合、 1 に非常に近くなり、精度が失われることに注意してください。この場合、代わりに Math.expm1
を使用すると、より高精度な小数部分を求めることができます。
例
Math.exp() の使用
js
Math.exp(-Infinity); // 0
Math.exp(-1); // 0.36787944117144233
Math.exp(0); // 1
Math.exp(1); // 2.718281828459045
Math.exp(Infinity); // 無限大
仕様書
Specification |
---|
ECMAScript® 2025 Language Specification # sec-math.exp |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
exp |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.