---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# Math.expm1()

The **`Math.expm1()`** function returns [E](./E.mdx) raised to the power of a number, subtracted by 1.

## Syntax

```js
Math.expm1(x)
```

### Parameters

- `x`
  - : A number.

### Return value

A number representing e<sup>x</sup> - 1, where e is [the base of the natural logarithm](./E.mdx).

## Description

For very small values of _x_, adding 1 can reduce or eliminate precision. The double floats used in JS give you about 15 digits of precision. 1 + 1e-15 \= 1.000000000000001, but 1 + 1e-16 = 1.000000000000000 and therefore exactly 1.0 in that arithmetic, because digits past 15 are rounded off.

When you calculate <math display="inline"><semantics><msup><mi mathvariant="normal">e</mi><mi>x</mi></msup></semantics></math> where x is a number very close to 0, you should get an answer very close to 1 + x, because <math display="inline"><semantics><mrow><munder><mo lspace="0em" rspace="0em">lim</mo><mrow><mi>x</mi><mo stretchy="false">→</mo><mn>0</mn></mrow></munder><mfrac><mrow><msup><mi mathvariant="normal">e</mi><mi>x</mi></msup><mo>−</mo><mn>1</mn></mrow><mi>x</mi></mfrac><mo>=</mo><mn>1</mn></mrow></semantics></math>. If you calculate `Math.exp(1.1111111111e-15) - 1`, you should get an answer close to `1.1111111111e-15`. Instead, due to the highest significant figure in the result of `Math.exp` being the units digit `1`, the final value ends up being `1.1102230246251565e-15`, with only 3 correct digits. If, instead, you calculate `Math.exp1m(1.1111111111e-15)`, you will get a much more accurate answer `1.1111111111000007e-15`, with 11 correct digits of precision.

Because `expm1()` is a static method of `Math`, you always use it as `Math.expm1()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).
