Created
January 23, 2013 22:07
-
-
Save ghalimi/4614489 to your computer and use it in GitHub Desktop.
NOMINAL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function NOMINAL(rate, periods) { | |
// Return error if any of the parameters is not a number | |
if (isNaN(rate) || isNaN(periods)) return '#VALUE!'; | |
// Return error if rate <=0 or periods < 1 | |
if (rate <=0 || periods < 1) return '#NUM!'; | |
// Truncate periods if it is not an integer | |
periods = parseInt(periods, 10); | |
// Return nominal annual interest rate | |
return (Math.pow(rate + 1, 1 / periods) - 1) * periods; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment