Comparing version 1.0.0 to 1.1.0
22
index.js
@@ -20,3 +20,23 @@ // function savingsAfterYear | ||
// function differenceAfterYearWithFirstYear | ||
// Calculates the difference in accumulated value based on identical returns, but difference in costs, where the first year can have a different cost | ||
// | ||
// Arguments: | ||
// initialValue: Number | ||
// returnPerYear: Number | ||
// baseCostPerYear: Number | ||
// costFirstYear: Number | ||
// newCostPerYear: Number | ||
// atYear: Number | ||
function differenceAfterYearWithFirstYear(initialValue, returnPerYear, baseCostPerYear, newCostFirstYear, newCostPerYear, atYear) { | ||
const baseReturns = (1 + returnPerYear - baseCostPerYear); | ||
const newReturnsFirstYear = (1 + returnPerYear - newCostFirstYear); | ||
const newReturns = (1 + returnPerYear - newCostPerYear); | ||
const differenceInReturnsAtYear = newReturnsFirstYear + Math.pow(newReturns, atYear - 1) - Math.pow(baseReturns, atYear); | ||
return initialValue * differenceInReturnsAtYear; | ||
} | ||
// function valueAtYearWithStandardDeviation | ||
@@ -41,2 +61,2 @@ // Calculates the total value at a year, based on return and standard deviation. | ||
module.exports = { differenceAfterYear, valueAtYearWithStandardDeviation }; | ||
module.exports = { differenceAfterYear, differenceAfterYearWithFirstYear, valueAtYearWithStandardDeviation }; |
{ | ||
"name": "algostrata", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "calculation library for algostrata", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2507
47