Merge pull request #2695 from shvchk/master

Fix compound interest formula
This commit is contained in:
Ilya Kantor 2021-08-14 23:37:18 +03:00 committed by GitHub
commit 71688e7590
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -96,7 +96,7 @@
let years = form.months.value / 12;
if (!years) return;
let result = Math.round(initial * (1 + interest * years));
let result = Math.round(initial * (1 + interest) ** years);
let height = result / form.money.value * 100 + 'px';
document.getElementById('height-after').style.height = height;

View file

@ -17,5 +17,5 @@ The formula is:
// initial: the initial money sum
// interest: e.g. 0.05 means 5% per year
// years: how many years to wait
let result = Math.round(initial * (1 + interest * years));
let result = Math.round(initial * (1 + interest) ** years);
```