log1p.3m (2010 09)

l
log1p(3M) log1p(3M)
NAME
log1p( ), log1pf( ), log1pl( ), log1pw( ), log1pq( ) - natural logarithm of one-plus-argument functions
SYNOPSIS
#include <math.h>
double log1p(double x);
HP Integrity Server Only
float log1pf(float x);
long double log1pl(long double x);
extended log1pw(extended x);
quad log1pq(quad x);
DESCRIPTION
The log1p() function computes the logarithmic function 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, are accurate when x is very small, namely:
expm1(n*log1p(x))/x
The preceding example would be applicable when calculating small daily interest rates. See also
com-
pound() and annuity().
Integrity Server Only
log1pf() is a float version of log1p(); it takes a float argument and returns a
float result.
log1pl() is a long double version of log1p(); it takes a long double argument and returns a
long double result.
log1pw() is an extended version of log1p(); it takes an extended argument and returns an
extended result.
log1pq() is equivalent to log1pl() on HP-UX systems.
USAGE
To use these functions, compile either with the default
-Ae option or with the
-Aa and
-D_HPUX_SOURCE options.
To use (for Integrity servers)
expw() or expq(), compile also with the -fpwidetypes
option.
Make sure your program includes
<math.h>, and link in the math library by specifying -lm
on the com-
piler or linker command line.
For more information, see the HP-UX floating-point guide for HP Integrity servers at the following site:
http://www.hp.com/go/fp.
RETURN VALUE
If x is +INFINITY,
log1p() returns +INFINITY.
If x = -1.0,
log1p() returns HUGE_VAL (equal to INFINITY) and raises the divide-by-zero exception.
If x < -1.0,
log1p() returns NaN and raises the invalid exception.
If x is NaN,
log1p() returns NaN.
When it raises no other exception, whether
log1p() raises the inexact exception is unspecified.
ERRORS
If x < -1.0,
log1p() sets errno to [EDOM].
Integrity Server Only
HP-UX
libm functions on Integrity servers do not set errno by default. For errno setting, compile
with the +Olibmerrno option.
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (2 pages)