Computes log(1 + x) for small x.
LOG1P(x)
x |
- |
A scalar, series or table. |
A scalar, series, or table.
log1p(1e-17)
returns 1.000000E-17.
log(1 + 1e-17)
returns 0.0.
expm1(log1p(1e-17))
returns 1.000000E-17.
exp(log(1 + 1e-17)) - 1
returns 0.0.
For real values, LOG1P is accurate for small x where 1 + x == 1 for double precision accuracy.
For small x, LOG1P(x) is approximately x, but LOG(1 + x) is approximately 0 for double precision accuracy.
See EXPM1 to compute EXP(x) - 1 for small x, the inverse of LOG1P.