Calc formula producing decimal places errantly

How can a simple formula adding currency formatted cells like =+L112+J113+K113 produce this:
52.4500000000004

https://wiki.documentfoundation.org/Faq/Calc/Accuracy

2 Likes

I have seen this in change-drawer systems based on Excel, etc. Dealing with currencies safely always requires rounding.
=ROUND(L112+J113+K113,2)
This same phenomenon can cause mysterious errors, such as drawers that are “on” but don’t balance. You have to check ROUND(...)=ROUND(...).
Errors can pop up because decimals are really binary, not 10-based, fractions in the computer system. So, not 52+45/100 but 52+x/2+y/4+z/8…

1 Like