Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<cfscript>
numeric function getPeriods(required numeric initBalance, required numeric intRate, required numeric desiredTotal) output="false" {
//assume interest rate is of format .5 = 50%
var periods = (log(arguments.desiredTotal) - log(arguments.initBalance))/log(1+arguments.intRate);
return (ceiling(periods));
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment