Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Accounting practice generally allows / requires rounding to some quantum value at each operation, like $0.001– The issue with using floating point for money isn’t that it has errors, it‘s that those errors don’t match the ones you get when using a paper ledger.


Firstly, if you treat floating-point without the proper care, that will still be the case if you use an integer for all currency amounts (as a number of cents) but reach for floating-point for percentage calculations and such.

Secondly, you can implement pencil-and-paper rounding rules using binary floating point! It's done by serializing to decimal text, working with the digits (perhaps as integers) and then converting back to floating point.

> those errors don’t match the ones you get when using a paper ledger.

If you have errors in your paper ledger, you're not much of an accountant.


> If you have errors in your paper ledger, you're not much of an accountant.

That’s because accounting practice has solidified certain inevitable innaccuracies as “the way things are done.” Any method that doesn’t produce the same accounting-correct but mathematically-imprecise results is “wrong,” and those innaccuracies are based on a fixed-point model.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: