Re:9999999999999999.0 – 9999999999999998.0
by smallnamespace on Saturday January 05, 2019 @06:20PM
(#18835017)
The correct solution is to understand how floating point number systems work and use near comparisons for floats.
Decimal fp is still 'wrong' for, say, 1/3 + 1/3 = 2/3.
Re:9999999999999999.0 – 9999999999999998.0
by int_19h on Saturday January 05, 2019 @08:30PM
(#18835719)
A lot of real-world data is already in base-10 for obvious reasons, and so an arrangement that lets you add, subtract and multiply those without worrying is worthwhile, even if it can't handle something more exotic.
Re:9999999999999999.0 – 9999999999999998.0
by smallnamespace on Sunday January 06, 2019 @01:53AM
(#18836990)
Would you really call 'any rational with divisible factors other than 2 and 5' to be 'exotic'?
Maybe we really should move back to base-60 like the Babylonians used, then you could at least divide by 3.
Re:9999999999999999.0 – 9999999999999998.0
by int_19h on Sunday January 06, 2019 @08:54PM
(#18842143)
Because humans standardized on base-10, and computers are ultimately for humans to use?
Re:9999999999999999.0 – 9999999999999998.0
by MauranKilom on Tuesday January 08, 2019 @07:38PM
(#18861271)
Maybe we should also add data types to every language that can convert exactly between inches, feet, miles and every other non-base-10 unit?
The argument "we want to look at base-10 in the end so it should be the internal representation" is really weak and ignores basically every other practical aspect.
> I appreciate that it may be surprising that 0.1 + 0.2 != 0.3 at first, or that many people are not educated about floating point, but I don't understand the people who "understand" floating point and continue to criticize it for the 0.1 + 0.2 "problem."
That's not a calculation that should require a high level of precision.