Main Content


Compute log(1+x) accurately for small values of x


y = log1p(x)


y = log1p(x) computes log(1+x), compensating for the roundoff in 1+x. log1p(x) is more accurate than log(1+x) for small values of x. For small x, log1p(x) is approximately x, whereas log(1+x) can be zero.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

See Also


Introduced before R2006a