[Haskell-cafe] Proper Handling of Exceptional IEEE Floating Point
Numbers
David Menendez
dave at zednenem.com
Sat Apr 24 10:27:26 EDT 2010
On Sat, Apr 24, 2010 at 5:56 AM, Barak A. Pearlmutter <barak at cs.nuim.ie> wrote:
>> Even deriving(Ord) only produces compare and relies on standard
>> definitions for other methods.
>
> I don't think that's actually a problem. Surely the IEEE Floating
> Point types would give their own definitions of not just compare but
> also <, <=, etc, overriding the problematic deriving(Ord) definitions
> of comparison in terms of compare and vice-versa.
There is the issue of deriving Ord for algebraic types that include Float.
data Foo = Foo Float deriving (Show, Eq, Ord)
*Main> Foo (0/0) > Foo (0/0)
True
*Main> 0/0 > 0/0
False
If compare (0/0) (0/0) = _|_, then Foo (0/0) == Foo (0/0) = _|_.
--
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>
More information about the Haskell-Cafe
mailing list