On Eq, was Re: [Haskell-cafe] When to use fancy types [Re: NumberTheory library]

Jacques Carette carette at mcmaster.ca
Sat May 14 09:49:59 EDT 2005

ajb at spamcop.net wrote:
> You could also argue that a function which distinguishes between +0 and -0
> doesn't respect "semantic equality" of Float and Double.  Your task, should
> you choose to accept it, is to define what the semantics of equality
> actually are for IEEE 754 floats. :-)

Anyone who thinks that +0 = -0 has never wrestled with a branch cut (and lost...).  Such people have the nasty habit 
of also thinking that ALL functions are continuous!  You might think they were constructivists or something.

Since +0 and -0 both exist as separate 'entities' (as computer bits), which are their own normal form, the real 
question to ask is, why would they be equal?  What kind of 'equivalence relation' is == if functions are allowed to 
differentiate between those two representations?

If course, if you manage to deal with that, then you might explain to mean what 1/(1/(-0)) = -0 really means in a 
denotational semantics universe which is compositional...  [the above identity is true in IEEE floats].


More information about the Haskell-Cafe mailing list