by BraveNewCurency · 2y ago · 0 comments
Computers can't represent 0.1 (in floating point), yet that hasn't stopped anyone from doing finances on their computer.
I don't think this is big news OR a parlor trick. It's just some obscure thing computers can't do that nobody has noticed for 70 years because nobody needed it.
Of course they can. They just can't do it in binary [EDIT: base 2]. But they can certainly do it in (say) BCD [EDIT: base 10].
floating point for financial data may have made sense back when my 386 DX CPU has a FP coprocessor and computation were dog slow.
In this day and age though you'll typically be not just a bit but much better using an abstraction that can represent numbers with decimals precisely, which frees you from a great many rounding error, epsilon computation, error propagation, etc.