5 ms·
yes, total ordering the concept is relevant, but any given total order is not necessarily relevant. You could make a total order that goes 0.0, 1.0, 0.5, 0.75,
by dnautics 5y ago
yes, total ordering the concept is relevant, but any given total order is not necessarily relevant. You could make a total order that goes 0.0, 1.0, 0.5, 0.75, 0.33, 0.56, 0.77, ... and that would NOT be useful for ranges.
In particular, the using IEEE order and building a range contaning NaNs is not semantically useful. Another detail is the distinction between -0.0 and 0.0; if you naively use the IEEE ordering to construct a type system you will have some problems with for example clopen ranges (-0.0, 0.0] and [-0.0, 0.0)
- charcircuit 5y agoThere shouldn't be any problems when using the total order from the standard as it defines -0 < 0 to be true. I don't see how there's a problem with a range containing NaN. It's no weirder than a range containing infinity.
- sharikous 5y agoIt defines also -0 == 0 and NaN != NaN. That's alone makes it rather weird
- colejohnson66 5y agoWhy is defining negative zero equal to positive zero confusing? Because -0 < 0? That's to ensure there's total ordering - if they're equal (but not "identical"), you need some definition on ordering them. I can understand the confusion many have with NaN, but the idea is that it's not a number, so it's not equal to anything in a number-like type.
- jjgreen 5y agohypot(Inf, NaN) == Inf suggests otherwise.
- dnautics 5y agoRight. I guess you didn't see that those two clopen intervals are mathematically identical, even though they are representationally unequal.