4 ms·
Comparing the raw bits using instructions intended for integers is quite fast.
by anonymoushn 4y ago
Comparing the raw bits using instructions intended for integers is quite fast.
- masklinn 4y agoNaN is not a single value, it's a multitude of them: a NaN is defined by all exponent bits being set to 1, so in a double there are 2^53 different possible NaN bit patterns (though only 2^52 values, because the sign bit is not part of the "NaN value", and possibly half that if you interpret signaling as a variable property of a fixed value)
- anonymoushn 4y agoYes. Many applications do not require that at most 1 nan and at most 1 zero be allowed in each collection but do have trouble if some items are not equal to themselves.