CFLib.org – Common Function Library Project

CompoundInterest(r, p, t)

Last updated April 23, 2002

author

Stephan Scheele

Version: 1 | Requires: CF5 | Library: FinancialLib

Description:
Calculate the compound interest after n years.

Return Values:
Returns a numeric value.

Example:

<cfoutput>
Future value:
<P>
100 dollars for 1 year at 10%: #DollarFormat(compoundInterest(0.1, 100, 1))#<br>
100 dollars for 2 years at 10%: #DollarFormat(compoundInterest(0.1, 100, 2))#<br>
100 dollars for 3 years at 10%: #DollarFormat(compoundInterest(0.1, 100, 3))#
</cfoutput>

Parameters:

Name Description Required
r Interest rate (3% = 0.03). Yes
p Principal Yes
t Duration of the loan in years. Yes

Full UDF Source:

/**
 * Calculate the compound interest after n years.
 * 
 * @param r 	 Interest rate (3% = 0.03). 
 * @param p 	 Principal 
 * @param t 	 Duration of the loan in years. 
 * @return Returns a numeric value. 
 * @author Stephan Scheele (stephan@stephan-t-scheele.de) 
 * @version 1, April 23, 2002 
 */
function compoundInterest(r, p, t){
  return (p* (1 + r)^t);
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson