United States-English |
|
|
HP-UX Reference > Ccompound(3M)HP Integrity Server OnlyHP-UX 11i Version 3: February 2007 |
|
NAMEcompound(), compoundf(), compoundl(), compoundw(), compoundq() — compound interest factor SYNOPSIS#include <math.h> double compound(double rate, double periods); float compoundf(float rate, float periods); long double compoundl(long double rate, long double periods); extended compoundw(extended rate, extended periods); quad compoundq(quad rate, quad periods); DESCRIPTIONThe compound() function computes the compound interest factor: (1 + rate) ** periods compoundf() is a float version of compound(); it takes float arguments and returns a float result. compoundl() is a long double version of compound(); it takes long double arguments and returns a long double result. compoundw() is an extended version of compound(); it takes extended arguments and returns an extended result. compoundq() is equivalent to compoundl() 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 compoundw() or compoundq(), compile also with the -fpwidetypes option. Make sure your program includes <math.h>. Link in the math library by specifying -lm on the compiler or linker command line. RETURN VALUEIf periods equals zero, compound() returns 1.0. Else, if either argument is a NaN, compound() returns a NaN. Else, if rate is less than -1, compound() returns a NaN and raises the invalid exception. Else, if rate equals -1, compound() is equivalent to pow(0, periods). Else, if rate equals +INFINITY, compound() is equivalent to pow(rate, periods). Else, if periods is infinite and rate equals zero, compound() returns 1.0. Else, if periods is infinite and rate does not equal zero, compound() is equivalent to exp(rate * periods). compound() returns a properly signed infinity in lieu of a value whose magnitude is too large, and raises the overflow and inexact exceptions. compound() raises the underflow and inexact exceptions whenever a result is tiny (essentially denormal or zero) and thereby suffers loss of accuracy, and may raise those exceptions if the result is merely tiny. |
Printable version | ||
|