cfpb / amortize

A node module to calculate the interest paid, principal paid, remaining balance, and monthly payment of a loan.
Creative Commons Zero v1.0 Universal
58 stars 19 forks source link

Return both raw and rounded values #4

Closed ascott1 closed 10 years ago

ascott1 commented 10 years ago

While calculating overall-loan-cost values, I noticed that they were occasionally off by a cent. That module uses amortize as a dependency to calculate the loan amortization table. It's like that these nice round values caused the slight miscalculations.

Now the module returns the following:

{ 
  interest: 36583.362108097754,
  principal: 16546.146128485594,
  balance: 163453.85387151438,
  payment: 885.4918039430557,
  interestRound: '36583.36',
  principalRound: '16546.15',
  balanceRound: '163453.85',
  paymentRound: '885.49'
}