Everything

log1p / log1pf / log1pl


Calculates the natural logarithm (base e) of d + 1.

[Format]

#include <math.h>

double log1p(double d);

float log1pf(float d);

long double log1pl(long double d);

[Parameters]

d Value for which the natural logarithm of this parameter + 1 is to be computed

[Return values]

Normal: Natural logarithm of d + 1

Abnormal: Domain error: Returns not-a-number.

Range error: Returns –HUGE_VAL, –HUGE_VALF, or –HUGE_VALL depending on the function.

[Remarks]

A domain error occurs if d is smaller than –1.

A range error occurs if d is –1.

log1p(d) provides more accurate calculation than log(1+d) even when d is near to 0.