expm1(x: array, /) array

Calculates an implementation-dependent approximation to exp(x)-1, having domain [-infinity, +infinity] and codomain [-1, +infinity], for each element x_i of the input array x.


The purpose of this function is to calculate exp(x)-1.0 more accurately when x is close to zero. Accordingly, conforming implementations should avoid implementing this function as simply exp(x)-1.0. See FDLIBM, or some other IEEE 754-2019 compliant mathematical library, for a potential reference implementation.

Special cases

For floating-point operands,

  • If x_i is NaN, the result is NaN.

  • If x_i is +0, the result is +0.

  • If x_i is -0, the result is -0.

  • If x_i is +infinity, the result is +infinity.

  • If x_i is -infinity, the result is -1.


x (array) – input array. Should have a floating-point data type.


out (array) – an array containing the evaluated result for each element in x. The returned array must have a floating-point data type determined by Type Promotion Rules.