From 1038ba2aaab4b4a5f66039114d0129ff5255ff9b Mon Sep 17 00:00:00 2001 From: Essam Al Joubori Date: Sun, 21 Dec 2014 17:37:59 -0500 Subject: [PATCH] Update principal --- finance.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/finance.js b/finance.js index 40572ec..cc1aa4d 100644 --- a/finance.js +++ b/finance.js @@ -85,14 +85,14 @@ Finance.prototype.ROI = function(cf0, earnings) { }; // Amortization -Finance.prototype.AM = function (principle, rate, period, yearOrMonth) { +Finance.prototype.AM = function (principal, rate, period, yearOrMonth) { var ratePerPeriod = rate / 12 / 100; // for inputs in years if (!yearOrMonth) { var numerator = ratePerPeriod * Math.pow((1 + ratePerPeriod), period * 12); var denominator = Math.pow((1 + ratePerPeriod), period * 12) - 1; - var am = principle * (numerator / denominator); + var am = principal * (numerator / denominator); return Math.round(am * 100) / 100; // for inputs in months @@ -100,7 +100,7 @@ Finance.prototype.AM = function (principle, rate, period, yearOrMonth) { var numerator = ratePerPeriod * Math.pow((1 + ratePerPeriod), period); var denominator = Math.pow((1 + ratePerPeriod), period) - 1; - var am = principle * (numerator / denominator); + var am = principal * (numerator / denominator); return Math.round(am * 100) / 100; } else { console.log('not defined'); @@ -135,9 +135,9 @@ Finance.prototype.DF = function(rate, numOfPeriods) { }; // Compound Interest (CI) -Finance.prototype.CI = function(rate, numOfCompoundings, principle, numOfPeriods) { +Finance.prototype.CI = function(rate, numOfCompoundings, principal, numOfPeriods) { - var CI = principle * Math.pow((1 + ((rate/100)/ numOfCompoundings)), numOfCompoundings * numOfPeriods); + var CI = principal * Math.pow((1 + ((rate/100)/ numOfCompoundings)), numOfCompoundings * numOfPeriods); return Math.round(CI * 100) / 100; };