# scipy.special.expm1¶

scipy.special.expm1(x) = <ufunc 'expm1'>

Compute exp(x) - 1.

When x is near zero, exp(x) is near 1, so the numerical calculation of exp(x) - 1 can suffer from catastrophic loss of precision. expm1(x) is implemented to avoid the loss of precision that occurs when x is near zero.

Parameters: x : array_like x must contain real numbers. float exp(x) - 1 computed element-wise.

Examples

>>> from scipy.special import expm1

>>> expm1(1.0)
1.7182818284590451
>>> expm1([-0.2, -0.1, 0, 0.1, 0.2])
array([-0.18126925, -0.09516258,  0.        ,  0.10517092,  0.22140276])


The exact value of exp(7.5e-13) - 1 is:

7.5000000000028125000000007031250000001318...*10**-13.


Here is what expm1(7.5e-13) gives:

>>> expm1(7.5e-13)
7.5000000000028135e-13


Compare that to exp(7.5e-13) - 1, where the subtraction results in a “catastrophic” loss of precision:

>>> np.exp(7.5e-13) - 1
7.5006667543675576e-13


#### Previous topic

scipy.special.log1p

#### Next topic

scipy.special.cosm1