## NAME

exp2, exp10, log2, compound, annuity - exponential, loga-
rithm, financial

## SYNOPSIS

cc [ __flag__ ... ] __file__ ... -lsunmath -lm [ __library__ ... ]
#include <sunmath.h>
double exp2(double __x__);
double exp10(double __x__);
double log2(double __x__);
double compound(double __r__, double __n__);
double annuity(double __r__, double __n__);

## DESCRIPTION

exp2() and exp10() return __2__**__x__ and __10__**__x__ respectively.
log2() returns the logarithm to base 2.
compound() and annuity() are functions important in finan-
cial computations of the effect of interest at periodic rate
__r__ over __n__ periods. compound(__r__,__n__) computes (__1__+__r__)**__n__, the com-
pound interest factor. Given an initial principal __P0__, its
value after __n__ periods is just __Pn__ = __P0__ *compound(__r__,__n__).
annuity(__r__,__n__) computes (__1__ - (__1__+__r__)**-__n__)/__r__, the present value
of annuity factor. Given an initial principal __P0__, the
equivalent periodic payment is just __p__ = __P0__ / annuity(__r__,__n__).
compound() and annuity() are computed using log1p() and
expm1() to avoid gratuitous inaccuracy for small-magnitude
__r__. compound() and annuity() are not defined for __r__ <= -1.
Thus a principal amount __P0__ placed at 5% annual interest com-
pounded quarterly for 30 years would yield
__P30__ = __P0__ * compound(.__05__/__4__, __30__.__0__ * __4__)
while a conventional fixed-rate 30-year home loan of amount
__P0__ at 10% annual interest would be amortized by monthly pay-
ments in the amount
__p__ = __P0__ / annuity(.__10__/__12__, __30__.__0__ * __12__).

## SEE ALSO

**exp(3M)**