Re:9999999999999999.0 – 9999999999999998.0
by yoz-y on Sunday January 06, 2019 @03:31AM
(#18837296)
To me the only downside of IEEE 754 is that most languages including C and C++ do not provide a sensible canonical comparison methods. This leads to surprised beginners and then a ton of home made solutions which are often not appropriate.
[ Parent
| on HN ]
Re:9999999999999999.0 – 9999999999999998.0
by MauranKilom on Tuesday January 08, 2019 @07:35PM
(#18861253)
Would you really want a default comparison where a == b does not imply a - b == 0?
Re:9999999999999999.0 – 9999999999999998.0
by yoz-y on Wednesday January 09, 2019 @01:46AM
(#18862810)
I think it depends, in languages which have implicit type coercion I think that would hurt. In languages like swift, where you need to explicitly cast even an Int to Double it would be less of a footgun. I'd rather floats have some overloaded operator maybe ~=, for approximate comparison.