News for hackers. Stuff that matters.
Re:Math.min(Math.max(num, min), max) by monktastic1 on Thursday August 20, 2020 @02:50PM (#24227051)
> 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.

Re:Math.min(Math.max(num, min), max) by shakow on Thursday August 20, 2020 @03:09PM (#24227369)
It depends on what space you're working on (e.g. the https://en.wikipedia.org/wiki/Extended_real_number_line define an order on the real field union {-∞, +∞}).
Re:Math.min(Math.max(num, min), max) by monktastic1 on Thursday August 20, 2020 @07:07PM (#24230064)
Yes, 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."
Re:Math.min(Math.max(num, min), max) by pmiller2 on Thursday August 20, 2020 @08:46PM (#24230717)
IEEE754 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.
Re:Math.min(Math.max(num, min), max) by Zecc on Friday August 21, 2020 @02:35AM (#24232604)
typeof NaN