braincore.math.exprel

Contents

braincore.math.exprel#

braincore.math.exprel(x)#

Relative error exponential, (exp(x) - 1)/x.

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. exprel(x) is implemented to avoid the loss of precision that occurs when x is near zero.

Parameters:

x – ndarray. Input array. x must contain real numbers.

Returns:

(exp(x) - 1)/x, computed element-wise.