Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ compound(3M) — Sun WorkShop 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exp(3M)

EXP2(3M)  —  MATHEMATICAL LIBRARY

NAME

exp2, exp10, log2, compound, annuity − exponential, logarithm, financial

SYNOPSIS

#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 financial computations of the effect of interest at periodic rate r over n periods.  compound(r,n) computes (1+r)∗∗n, the compound 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 compounded 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 payments in the amount

 p = P0 / annuity(.10/12, 30.0 ∗ 12).
 

SEE ALSO

exp(3M)

Sun Release 4.1  —  Last change: 22 Jul 1994

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026