$3,415.3,900,000,000,003
(i.redd.it)
You're viewing a single comment thread. View all comments, or full comment thread.
Comments (27)
sorted by:
Potentially yes, though they'd have to be careful to not do any sort of conversion to floating point at all, including using library functions to convert a string to a floating point number. Simply multiplying by 100.0 gives you the same problem:
There's also a class of numeric algorithms called arbitrary precision arithmetic that can be used to provide exact results from calculations between arbitrarily large numbers. Less flexible (but also able to provide exact results within the constraints of the size of the data type) are what they call "decimal data types" provided by some programming languages.
I maintain a small and obscure piece of open source financial software as a hobby project, and getting this stuff exactly right (which I'm sure I'm not, despite my best efforts) is a pain.