CFLib.org – Common Function Library Project

FutureValue(IT, PMT, PV, NP)

Last updated August 2, 2001
Download UDF

author

Raymond Thompson                                  Raymond Thompson

Version: 1 | Requires: ColdFusion 5 | Library: FinancialLib

Description:
Calculate the future value of investment with regular deposits.

Return Values:
Returns a numeric value.

Example:

Future Value = <cfoutput>#FutureValue(0.08,500,0,24)#</cfoutput>

Parameters:

Name Description Required
IT Interest rate per year (8% = 0.08) Yes
PMT Number of payments. Yes
PV Present value. Yes
NP Number of periods. Yes

Full UDF Source:

<cfscript>
/**
* Calculate the future value of investment with regular deposits.
*
* @param IT      Interest rate per year (8% = 0.08)
* @param PMT      Number of payments.
* @param PV      Present value.
* @param NP      Number of periods.
* @return Returns a numeric value.
* @author Raymond Thompson (rayt@qsystems.net)
* @version 1, April 23, 2002
*/

function FutureValue(IR,PMT,PV,NP) {
var tpv = abs(pv);
var tnp = abs(np);
var fv = pv;
var tpmt = -abs(pmt);
var tir = abs(ir) / 12;
var scale=0;

if(ArrayLen(Arguments) gt 4) {
scale = 10^abs(Arguments[4]);
}
if (ir eq 0) {
fv = tpv + abs(tpmt * tnp);
} else {
q = (1 + tir)^tnp;
fv = (-pmt + q * pmt + tir * q * tpv) / tir;
}
if (scale NEQ 0) {
fv = int(fv * scale + 0.5) / scale;
}
return(-fv);
}
</cfscript>

Search CFLib.org


Latest Additions

Jose Diaz-Salcedo Jose Diaz-Salcedo added
cfRssFeed
2 day(s) ago

Raymond Compton Raymond Compton added
structBlend
23 day(s) ago

Duncan Duncan added
IsZIPUK
23 day(s) ago

Todd Sharp Todd Sharp added
getTagContentAll
29 day(s) ago

Gerald Guido Gerald Guido added
ListReturnDuplicat...
1 month(s) ago

Created by Raymond Camden / Design by Justin Johnson