Merge pull request #2695 from shvchk/master
Fix compound interest formula
This commit is contained in:
commit
71688e7590
2 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue