Math.expm1()

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.expm1() 函数返回 E^x - 1, 其中 x 是该函数的参数,E 是自然对数的底数 2.718281828459045

语法

Math.expm1(x)

参数

x

任意数字。

描述

参数 x 会被自动类型转换成 number 类型。

expm1 是 "exponent minus 1" 的缩写。

示例

js
Math.expm1(-Infinity); // -1
Math.expm1(-1); // -0.6321205588285577
Math.expm1(-0); // -0
Math.expm1(0); // 0
Math.expm1(1); // 1.718281828459045
Math.expm1(Infinity); // Infinity

规范

Specification
ECMAScript® 2025 Language Specification
# sec-math.expm1

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
expm1

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

参见