expm1¶
- expm1(x: array, /) array ¶
Calculates an implementation-dependent approximation to
exp(x)-1
for each elementx_i
of the input arrayx
.Note
The purpose of this function is to calculate
exp(x)-1.0
more accurately whenx
is close to zero. Accordingly, conforming implementations should avoid implementing this function as simplyexp(x)-1.0
. See FDLIBM, or some other IEEE 754-2019 compliant mathematical library, for a potential reference implementation.Note
For complex floating-point operands,
expm1(conj(x))
must equalconj(expm1(x))
.Note
The exponential function is an entire function in the complex plane and has no branch cuts.
- Parameters:
x (array) – input array. Should have a floating-point data type.
- Returns:
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.
Notes
Special cases
For real-valued floating-point operands,
If
x_i
isNaN
, the result isNaN
.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
.
For complex floating-point operands, let
a = real(x_i)
,b = imag(x_i)
, andIf
a
is either+0
or-0
andb
is+0
, the result is0 + 0j
.If
a
is a finite number andb
is+infinity
, the result isNaN + NaN j
.If
a
is a finite number andb
isNaN
, the result isNaN + NaN j
.If
a
is+infinity
andb
is+0
, the result is+infinity + 0j
.If
a
is-infinity
andb
is a finite number, the result is+0 * cis(b) - 1.0
.If
a
is+infinity
andb
is a nonzero finite number, the result is+infinity * cis(b) - 1.0
.If
a
is-infinity
andb
is+infinity
, the result is-1 + 0j
(sign of imaginary component is unspecified).If
a
is+infinity
andb
is+infinity
, the result isinfinity + NaN j
(sign of real component is unspecified).If
a
is-infinity
andb
isNaN
, the result is-1 + 0j
(sign of imaginary component is unspecified).If
a
is+infinity
andb
isNaN
, the result isinfinity + NaN j
(sign of real component is unspecified).If
a
isNaN
andb
is+0
, the result isNaN + 0j
.If
a
isNaN
andb
is not equal to0
, the result isNaN + NaN j
.If
a
isNaN
andb
isNaN
, the result isNaN + NaN j
.
where
cis(v)
iscos(v) + sin(v)*1j
.Changed in version 2022.12: Added complex data type support.