2 cents worth of Rounding calculations
- Posted by Senator Sep 12, 2018
- 1149 views
Irv has added a really neat print.pdf routine to his EUGTK amortization program: http://sites.google.com/view/euphotos/home Hey, Irv, how about adding the snippet programing samples to your examples or utilities folder - maximize exposure.
Examples below using Irv Mullins EuGtk version of amort.ex Same results using my console based amort.ex
-- Without rounding monthly_payment=balance_remaining*(monthly_interest/(1.0-power(1.0+monthly_interest,-n_payments))) payment_allocated_to_interest=balance_remaining*monthly_interest
Principal = $10,000 Interest=18 # of payments = 12 -------------------------------------10,000.00 1 916.79 766.79 150.00 9,233.20 <> 9233.21 2 916.79 778.30 138.49 8,454.89 <> 8454.9 6 916.79 826.06 90.73 5,223.18 7 916.79 838.45 78.34 4,384.72 <> 4384.73 8 916.79 851.02 65.77 3,533.69 <> 3533.7 12 916.79 903.25 13.54 0.00 --Payments Principle Interest 11,001.59 10,000.00 1,001.59
-- With round function from std/math.e monthly_payment=round(balance_remaining*(monthly_interest/(1.0-power(1.0+monthly_interest,-n_payments))),100) payment_allocated_to_interest=round(balance_remaining*monthly_interest,100)
1 916.80 766.80 150.00 9,233.20 2 916.80 778.30 138.50 8,454.90 3 916.80 789.98 126.82 7,664.92 4 916.80 801.83 114.97 6,863.09 5 916.80 813.85 102.95 6,049.24 6 916.80 826.06 90.74 5,223.18 7 916.80 838.45 78.35 4,384.73 8 916.80 851.03 65.77 3,533.70 9 916.80 863.79 53.01 2,669.91 10 916.80 876.75 40.05 1,793.16 11 916.80 889.90 26.90 903.26 12 916.81 903.26 13.55 0.00 -- Payments Principle Interest 11,001.61 10,000.00 1,001.61