As first mentioned in bug 795362 (https://bugs.gnucash.org/show_bug.cgi?id=795362#c4), it would be helpful to have interest/principal calculating functions in fin.scm that: 1: Allow you to specify the size of the payment 2: Allow you to specify how many decimal places the balance is rounded to at each payment. For example, some lenders calculate the required payment for the agreed-upon amortization, then round that value up to the next dollar (resulting in a lower final payment). Likewise, some lenders round the amount of interest accrued each payment period to the nearest cent before applying the payment. ------------------------------------------------------------------ EXAMPLE: Say you borrow $100,000 at 5%/yr, compounded semi-annually. You amortize the loan over 2 years with 24 monthly payments. This calls for payments of $4,384.8418 at the end of each month. The lender rounds this up to $4,385. If you calculate the balance at each period directly using the annuity formula (like calc-principal does), and then use the those values to calculate the principal and interest paid, the first 10 rows of the amortization table look like this (the values are rounded to the nearest cent for _display_, but not for calculating the next period): PERIOD | Open | Interest | Principal | End 1 |$100,000.00 | $412.39 | $3,972.61 | $96,027.39 2 | $96,027.39 | $396.01 | $3,988.99 | $92,038.40 3 | $92,038.40 | $379.56 | $4,005.44 | $88,032.96 4 | $88,032.96 | $363.04 | $4,021.96 | $84,011.00 5 | $84,011.00 | $346.45 | $4,038.55 | $79,972.45 6 | $79,972.45 | $329.80 | $4,055.20 | $75,917.25 7 | $75,917.25 | $313.08 | $4,071.92 | $71,845.33 8 | $71,845.33 | $296.28 | $4,088.72 | $67,756.61 9 | $67,756.61 | $279.43 | $4,105.57 | $63,651.04 10 | $63,651.04 | $262.49 | $4,122.51 | $59,528.53 If you calculate each period sequentially (rounding the interest and balance at each step), you get: PERIOD | Open | Interest | Principal | End 1 |$100,000.00 | $412.39 | $3,972.61 | $96,027.39 2 | $96,027.39 | $396.01 | $3,988.99 | $92,038.40 3 | $92,038.40 | $379.56 | $4,005.44 | $88,032.96 4 | $88,032.96 | $363.04 | $4,021.96 | $84,011.00 5 | $84,011.00 | $346.45 | $4,038.55 | $79,972.45 6 | $79,972.45 | $329.80 | $4,055.20 | $75,917.25 7 | $75,917.25 | $313.08 | $4,071.92 | $71,845.33 8 | $71,845.33 | $296.28 | $4,088.72 | $67,756.61 9 | $67,756.61 | $279.42 | $4,105.58 | $63,651.03 <- Different 10 | $63,651.03 | $262.49 | $4,122.51 | $59,528.52 <- still $0.01 off ---------------------------------------------------------------------------- I have written a set of appropriate functions, and will submit a pull-request.
Tim's PR is merged.