On Sat, Dec 15, 2018 at 7:13 PM Keith Medcalf <kmedc...@dessus.com> wrote:
> > >And yet ... here we are. The post which started this thread summed > >currency amounts and reached a total of 211496.25999999992 . > > >Yes, you can say 'that would have been rounded before it was > >printed'. But then you're into the old questions: do you round at > >every step, or only at the end ? Do you round or truncate ? Where > >does the fraction go ? etc. etc.. > > You apply half-even rounding (not elementary school 4/5 rounding) only for > display (output) and never round intermediates. The "fraction" does not > exist ... Though if you do 4/5 rounding rather than half-even rounding the > accumulated errors will amount to quite a sum. > TIL, thanks! I'd also like to point out a problem with integer money: inflation. For USD it's been OK so far, but imagine having to handle the Zimbabwean Dollar, which ended up having 100 trillion dollar notes. Good way to overflow your integers. With floating point, that's not a problem. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users