5 ms·
NaN values can have sign bit set. This will unset it.
by im3w1l 5y ago
NaN values can have sign bit set. This will unset it.
- toxik 5y agoSo we defined abs(NaN), sounds like a feature to me ;-)
- gene91 5y agoYou made a good point. But one might argue that -nan should become nan after an abs operation. I don't know enough about this topic to determine whether such an argument has merit though.
- HWR_14 5y agoIt's not -NaN vs NaN. There are a bunch of NaN types, which are not related like that. It could (according to the spec) change "NaN: Attempt to arcsin value greater than 1" to "NaN: Zero divided by Zero operation"
- im3w1l 5y agoToo late to edit now, but the floating point standard actually specifies that this is what abs should do.