United States-English |
|
|
HP-UX Reference > Llog1p(3M)HP-UX 11i Version 3: February 2007 |
|
NAMElog1p(), log1pf(), log1pl(), log1pw(), log1pq() — natural logarithm of one-plus-argument functions DESCRIPTIONThe 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 Onlylog1pf() 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. USAGETo 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 VALUEIf 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. |
Printable version | ||
|