Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > L

log1p(3M)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

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 compound() 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 compiler 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.

STANDARDS CONFORMANCE

log1p() : XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ``IEC 60559 floating-point arithmetic'')

log1pf(), log1pl() : ISO/IEC C99 (including Annex F, ``IEC 60559 floating-point arithmetic'')

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.