log1p(), log1pf(), log1pl() — Natural log of x+1

Standards

Standards / Extensions C or C++ Dependencies

XPG4.2
C99
Single UNIX Specification, Version 3
C++ TR1 C99

both  

Format

#define _XOPEN_SOURCE_EXTENDED 1
#include <math.h>

double log1p(double x);
C99:
#define _ISOC99_SOURCE
#include <math.h>

float log1pf(float x);
long double log1pl(long double x);
C++ TR1 C99:
#define _TR1_C99
#include <math.h>

float log1p(float x); 
long double log1p(long double x);

General description

Computes
Formula of the functions
The value of x must be greater than -1.0.
Note: The following table shows the viable formats for these functions. See IEEE binary floating-point for more information about IEEE Binary Floating-Point.
Function Hex IEEE
log1p X X
log1pf X X
log1pl X X

Returned value

If successful, log1p() returns the value of the above function of x.

log1p() will fail under the following conditions:
  • If x is less than -1.0, log1p() will return -HUGE_VAL and set errno to EDOM.
  • If x is equal to -1.0, log1p() will return -HUGE_VAL and set errno to ERANGE.
Special behavior for IEEE: If successful, log1p() returns the
REQTEXT

The value of x must be greater than -1.0.

log1p() will fail under the following conditions:
  • If x is less than -1.0, log1p() will return NaNQ and set errno to EDOM.
  • If x is equal to -1.0, log1p() will return -HUGE_VAL and errno remains unchanged.
Note: When environment variable _EDC_SUSV3 is set to 2, and if x is equal to -1.0, the function returns -HUGE_VAL and sets errno to ERANGE.

Related information