log1p, log1pf, log1pl, log1pd32, log1pd64, and log1pd128 Subroutines

Purpose

Computes a natural logarithm.

Syntax

#include <math.h>

float log1pf (x)
float x;

long double log1pl (x)
long double x;

double log1p (x)
double x;
_Decimal32 log1pd32 (x)
_Decimal32 x;

_Decimal64 log1pd64 (x)
_Decimal64 x;

_Decimal128 log1pd128 (x)
_Decimal128 x;

Description

The log1pf, log1pl, log1p, log1pd32, log1pd64, and log1pd128 subroutines compute loge (1.0 + x).

An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.

Parameters

Item Description
x Specifies the value to be computed.

Return Values

Upon successful completion, the log1pf, log1pl, log1p, log1pd32, log1pd64, and log1pd128 subroutines return the natural logarithm of 1.0 + x.

If x is -1, a pole error occurs and the log1pf, log1pl, log1p, log1pd32, log1pd64, and log1pd128 subroutines return -HUGE_VALF, -HUGE_VALL, -HUGE_VAL, -HUGE_VAL_D32, -HUGE_VAL_D64, and -HUGE_VAL_D128 respectively.

For finite values of x that are less than -1, or if x is -Inf, a domain error occurs, and a NaN is returned.

If x is NaN, a NaN is returned.

If x is ±0, or +Inf, x is returned.

If x is subnormal, a range error may occur and x should be returned.