Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ log1p(3M) — HP-UX 10.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

log(3M)

expm1(3M)

isinf(3M)

isnan(3M)

log1p(3M)

NAME

log1p() − computes logarithmic functions

SYNOPSIS

#include <math.h>

double log1p(double x);

DESCRIPTION

The log1p() function computes logarithmic functions. 

The log1p() function is equivalent to log(1 + x), but may be more accurate for very small values of x.

The expm1() and log1p() functions are useful to guarantee that financial calculations of (((1+x)**n)-1)/x, namely:

expm1(n * log1p(x))/x

are accurate when x is very small (for example, when calculating small daily interest rates).  These functions also simplify writing accurate inverse hyperbolic functions. 

To use this function, link in the math library by specifying −lm on the compiler or linker command line. 

RETURN VALUE

log1p() returns the natural logarithm of (1 + x).

If x is +INFINITY, log1p() returns +INFINITY. 

If x = −1.0, log1p() returns −HUGE_VAL. 

If x is NaN, log1p() returns NaN. 

If x < −1.0, log1p() returns NaN and sets errno to [EDOM]. 

ERRORS

If log1p() fails, errno is set to the following value. 

[EDOM] x is less than −1.0. 

SEE ALSO

log(3M), expm1(3M), isinf(3M), isnan(3M). 

STANDARDS CONFORMANCE

log1p(): XPG4.2
 

Hewlett-Packard Company  —  HP-UX Release 10.20:  July 1996

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026