[GNC] Canadian Mortgage

David G. Pickett dgpickett at aol.com
Thu Feb 3 14:51:35 EST 2022


Banks here cannot round up (charge above the contracted/advertised rate), so their calculations are truncated.  However, many are lured into using computer binary floating point numbers to do money (Sybase, SQL Server), and it can lose a tiny fraction of a cent, and so lose the last cent (1.0 / 3.0 = .3333333333333333 * 3 = .9999999999999999, which truncates to 0).  My last code change at Bank of America was to add a very tiny bit to balance transfer fees so that cent was not lost, not to satisfy the bank, but to satisfy testers validating a huge software update.

Interest calculations are usually the sum of all daily balances * interest rate / count of days, truncated down so they do not charge more than advertised, maybe a penny short.  Good luck programming all the possible variations in the real world: a) rounding up/down by any of several rounding rules (see wiki), b) truncation (convert to integer) blindly, or c) adding a tiny bit before truncating to the now fractionally perfect sum.

https://en.wikipedia.org/wiki/Rounding

Good luck!  I just enter the number they compute.


More information about the gnucash-user mailing list