expm1

Exponential of the argument, minus one.

Syntax

R = expm1(x)

Inputs

x
Type: double | complex
Dimension: scalar | vector | matrix

Outputs

R
The returned values.
Dimension: scalar | vector | matrix.

Example

Show that expm1(x) has better accuracy than exp(x) - 1 for small real values of x

.
x = 1e-18;
a = exp(x)-1
a = 0
b = expm1(x)
b = 1e-18

The value of a has lost precision, but b has not.