3 ms·
> Does NaN have an "order" in the set of reals or integers or whatever? By definition, something that is not a number (real, integer, etc.) cannot be compared
by monktastic1 6y ago
> Does NaN have an "order" in the set of reals or integers or whatever?
By definition, something that is not a number (real, integer, etc.) cannot be compared to something that is a number.
- shakow 6y agoIt depends on what space you're working on (e.g. the https://en.wikipedia.org/wiki/Extended_real_number_line https://en.wikipedia.org/wiki/Extended_real_number_line define an order on the real field union {-∞, +∞}).
- monktastic1 6y agoYes, but in that context, ∞ is a number. We often interpret "NaN" to mean "infinity," but it only means "not a number." Maybe I'm being pedantic, but if we want a token representing infinity as a number, it ought not be called "not a number."
- pmiller2 6y agoIEEE754 has both infinity and NaN. They are different. NaN is always the result of an invalid operation, such as trying to take the square root of a negative number. Infinity is for when the result would be valid, but is too large in magnitude to represent. There is both positive and negative infinity.
- Zecc 6y agotypeof NaN