
26 Sep
2011
26 Sep
'11
9:08 a.m.
Roman Leshchinskiy writes:
Daniel Fischer wrote:
Proposal: Provide Double and Float with Eq and Ord instances that introduce a total order.
I'm strongly against this, for the reasons that have already been mentioned. and because there a good reasons for why the IEEE semantics is the way it is.
But compare cannot implement the IEEE semantics and be total, because the Ordering type cannot represent "unordered". Something has to give. The nearest compare can do is to throw an exception if an argument is NaN (with compatible behaviour from the comparison operators). At least that would not be silent or subtle breakage.