Proposal: New Eq and Ord instances for Double and Float

Paterson, Ross R.Paterson at
Mon Sep 26 15:08:43 CEST 2011

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.

More information about the Libraries mailing list