Re:GCC optimized code gives strange floating point results
by kobeya on Monday February 27, 2017 @12:01AM
(#13742003)
It's also a credulous bug that a standard ordering isn't defined for NaNs.
[ Parent
| on HN ]
Re:GCC optimized code gives strange floating point results
by brucedawson on Monday February 27, 2017 @02:02AM
(#13742430)
So, you want to redefine IEEE floats? 'cause it says that there is no ordering for NaNs.
And if you do redefine IEEE floats, where do NaNs go, and why is that better?
Re:GCC optimized code gives strange floating point results
by kobeya on Monday February 27, 2017 @03:23AM
(#13742766)
I'm saying IEEE shouldn't have defined them that way, yes. It was an arbitrary choice. As to where, before negative infinity or after positive infinity; I don't really care which. But the fact that we can't have good things (e.g. a standards compliant std::set<float>) because of a standards committee punted on making that choice makes me sad :(
Re:GCC optimized code gives strange floating point results
by Sharlin on Monday February 27, 2017 @04:07AM
(#13742912)
I do wonder why they didn't special-case std::less for floats. They already did it for pointers - operator< for pointers isn't even defined, much less a strict weak order, if the operands do not point to the same object (region of storage). This is in order to facilitate non-flat addressing schemes. std::less, however, is explicitly specified to work with any pair of pointers.