3 ms·
Ok, so tell me, what is the "right size" that will make 0.1 + 0.2 == 0.3? Because, in binary, I don't think you'll be able to answer.
by marcosdumay 11y ago
Ok, so tell me, what is the "right size" that will make 0.1 + 0.2 == 0.3?
Because, in binary, I don't think you'll be able to answer.
- xaduha 11y agoComputers are here to help us. Creating abstractions is the name of the game. "Technically correct" isn't the kind of correct we, as humans, want here. Plenty of languages get it right the way you would naively expect already, as shown here http://0.30000000000000004.com http://0.30000000000000004.com
- marcosdumay 11y agoThat's a completely different problem, and really, I have no idea why it cycling on the comments. Yes, some languages print floating point numbers in a friendly way by default (really if you are going with the default format, anything will do). In what way does it change equality tests?
- xaduha 11y agoNo only print, but store too. If the result is mathematically accurate, then what does it matter how it works inside? That's why we use abstractions, for convenience. Yes, there are trade-offs, but that's the price we should be willing to pay. https://en.wikipedia.org/wiki/DWIM https://en.wikipedia.org/wiki/DWIM