CFLib.org – Common Function Library Project

FutureValue(IT, PMT, PV, NP)

Last updated August 2, 2001

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

 
Rated 0 time(s). Average Rating: 0

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

Return Values:
Returns a numeric value.

Example:

view plain print about
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:

view plain print about
<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>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Adam Cameron Adam Cameron added
composeDateTime
15 day(s) ago

Chris Weller Chris Weller added
convertQueryStri...
a while ago

Greg Nettles Greg Nettles added
arrayDiff
a while ago

Nathan Dintenfass Nathan Dintenfass added
ArrayOfStructsSo...
a while ago

Top Rated

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 36 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Rachel Lehman deAccent
Rated 5.0, 6 time(s)

Isaac Dealey                                      countArbitraryDa...
Rated 5.0, 5 time(s)

Created by Raymond Camden / Design by Justin Johnson