HP-UX Reference (11i v3 07/02) - 3 Library Functions A-M (vol 6)

c
compound(3M) compound(3M)
(HP Integrity Server Only)
NAME
compound(), 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);
DESCRIPTION
The 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.
USAGE
To 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 VALUE
If 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.
ERRORS
No errors are defined.
SEE ALSO
annuity(3M), exp(3M), expm1(3M), pow(3M), math(5).
STANDARDS CONFORMANCE
These functions are not specified by any standard.
192 Hewlett-Packard Company 1 HP-UX 11i Version 3: February 2007