SciPy

darkhistory.utilities.log_1_plus_x

darkhistory.utilities.log_1_plus_x(x)

Computes log(1+x) with greater floating point accuracy.

Unlike scipy.special.log1p, this can take float128. However the performance is certainly slower. See [1] for details. If that trick does not work, the code reverts to a Taylor expansion.

Parameters:
x : float or ndarray

The input value.

Returns:
ndarray

log(1+x).

Footnotes

[1]David Goldberg. 1991. What every computer scientist should know about floating-point arithmetic. ACM Comput. Surv. 23, 1 (March 1991), 5-48.

Previous topic

darkhistory.utilities.is_log_spaced

Next topic

darkhistory.utilities.log_series_diff

This Page