log1p¶
- log1p(x: array, /) array¶
Calculates an implementation-dependent approximation to
log(1+x), wherelogrefers to the natural (basee) logarithm, having domain[-1, +infinity]and codomain[-infinity, +infinity], for each elementx_iof the input arrayx.Note
The purpose of this function is to calculate
log(1+x)more accurately whenxis close to zero. Accordingly, conforming implementations should avoid implementing this function as simplylog(1+x). See FDLIBM, or some other IEEE 754-2019 compliant mathematical library, for a potential reference implementation.Special cases
For floating-point operands,
If
x_iisNaN, the result isNaN.If
x_iis less than-1, the result isNaN.If
x_iis-1, the result is-infinity.If
x_iis-0, the result is-0.If
x_iis+0, the result is+0.If
x_iis+infinity, the result is+infinity.
- 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.