Skip to content

Instantly share code, notes, and snippets.

@camilonova
Created March 11, 2024 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save camilonova/1ac50f91db7ab6381836a93fa21e963b to your computer and use it in GitHub Desktop.
Save camilonova/1ac50f91db7ab6381836a93fa21e963b to your computer and use it in GitHub Desktop.
Calcular tasa de interes mensual a partir de tasa efectiva anual
function calculate(annualRate) {
// annual-rate could be integer 20 (as in 20%)
var periods = 12; // months in a year
var monthlyRate = ((Math.pow( (1 + (annualRate / 100) ), (30/360) ) - 1) * 100).toFixed(2)
return monthlyRate + "%";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment