HP-UX Reference (11i v2 07/12) - 3 Library Functions A-M (vol 6)
a
annuity(3M) annuity(3M)
(HP Integrity Server Only)
NAME
annuity( ), annuityf( ), annuityl( ), annuityw( ), annuityq( ) - present value factor for annuity
SYNOPSIS
#include <math.h>
double annuity(double rate, double periods);
float annuityf(float rate, float periods);
long double annuityl(long double rate, long double periods);
extended annuityw(extended rate, extended periods);
quad annuityq(quad rate, quad periods);
DESCRIPTION
The annuity() function computes the present value factor for an annuity:
(1 - (1 + rate)**(-periods)) / rate
annuityf() is a float version of annuity(); it takes float arguments and returns a float
result.
annuityl() is a long double version of annuity(); it takes long double arguments and
returns a long double result.
annuityw() is an extended version of annuity() ; it takes extended arguments and returns an
extended result.
annuityq() is equivalent to annuityl() 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
annuityw() or annuityq() , compile 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,
annuity() returns 0.0.
Else, if rate equals zero, annuity() returns periods.
Else, if either argument is a NaN, annuity() returns a NaN.
Else, if rate <-1, annuity() returns a NaN and raises the invalid exception.
Else, if rate = -1 and periods = +INFINITY,
annuity() returns +INFINITY.
Else, if rate equals -1 and periods >0,
annuity() is equivalent to 1.0 / 0.0
.
Else, if rate equals -1,
annuity() returns -1.
Else, if rate equals +INFINITY and periods >= 0, annuity() returns +0.0.
Else, if rate equals +INFINITY and -1 < periods <0, annuity() returns -0.0.
Else, if rate equals +INFINITY and periods =-1, annuity() returns -1.
Else, if rate equals +INFINITY, annuity() returns -INFINITY.
Else, if periods is infinite and (rate * periods)>0, annuity() is equivalent to 1.0 / rate.
Else, if periods is infinite, annuity() returns periods.
annuity() returns a properly signed infinity in lieu of a value whose magnitude is too large, and raises
the overflow and inexact exceptions.
annuity() 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.
104 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: December 2007 Update