Proposal: New Eq and Ord instances for Double and Float

Malcolm Wallace malcolm.wallace at me.com
Tue Sep 27 11:22:41 CEST 2011


>>> Proposal: Provide Double and Float with Eq and Ord instances that introduce
>>> a total order.

Some implementations of Haskell *already* provide a total ordering for the Float type, and this is perfectly allowed within the definition of the 2010 Language Report.

To quote Section 6.4:

"Float is implementation-defined; it is desirable that this type be at least equal in range and precision to the IEEE single-precision type. [...]  The results of exceptional conditions (such as overflow or underflow) on the fixed-precision numeric types are undefined; an implementation may choose error (⊥, semantically), a truncated value, or a special value such as infinity, indefinite, etc."

If any program intends to rely on the IEEE behaviour for exceptional conditions, then for correctness, it really ought to use the RealFloat class method "isIEEE" to be certain that the compiler implementation actually supports that.

Regards,
    Malcolm






More information about the Libraries mailing list