Skip to content

Instantly share code, notes, and snippets.

@alancpazetto
Last active August 7, 2018 01:04
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 alancpazetto/4f81de77c3cd46aeffb9cfd7a892c2fe to your computer and use it in GitHub Desktop.
Save alancpazetto/4f81de77c3cd46aeffb9cfd7a892c2fe to your computer and use it in GitHub Desktop.

Juros LIS / Cheque especial Itaú

Juros ao mês: 11,95%
Juros ao dia: 0,3754%

Conta de juros composto

total = M * ( 1 + j )^n

Onde:

  • total é o valor final
  • M é o montante, valor inicial
  • j é o valor do juros convertido em decimal: 100% = 1, 13% = 0,13
  • n é a quantidade do perído, para juros ao mês utilizar o número de meses

Exemplo:

  • M = 1000
  • j = 0,3754% => 0,003754 (juros ao dia)
  • n = 12 dias
total = 1000 * (1+0,003754)^12
total = 1000 * 1,0459898437
total = 1.045,9898437

Total de Juros a pagar = 45,9898437

Conversão de período do juros

http://fazaconta.com/taxa-mensal-vs-anual.htm

JavaScript Rocks!!

// M * (1 + 0.3754) ^ n;

const calc = (montante, dias, apenasJuros = false) => {
  let v = montante * ( Math.pow( 1.003754, dias) );
  if (apenasJuros) {
    v -= montante;
  }
  return v;
}

const arrJuros = [
  calc(2040, 3, true),
  calc(9040, 8, true),
  calc(5940, 4, true),
];

const sumJuros = arrJuros.reduce( (acc, j) => acc += j, 0);

console.log(arrJuros, sumJuros);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment