compare on Double

Ian Lynagh igloo at
Thu Mar 22 10:32:34 EDT 2007

On Thu, Mar 22, 2007 at 10:52:24AM +0000, Neil Mitchell wrote:
> My main point was the question of whether compilers are free to
> optimise _|_ to a concrete (non-nonsensical) value.


Note that in the bytestring case the compiler doesn't do so, it's the
library that does (by telling the compiler to rewrite things with

And it's very naughty for doing so, and should go to bed with no supper.

Unfortunately, it's very appealing in bytestring's case...

> I'm still not happy with adding more incompleteness into something
> that intuitively feels safe - compare is pretty benign. Having a crash
> on division is something that does appeal to me more.
> For reference, my Catch tool treats Float/Double compare as never
> crashing, and division by zero as always crashing

Even for Double/Float?

There's also:

    Prelude> (minBound :: Int) `div` (-1)
    *** Exception: arithmetic overflow

but you probably can't do much about that in Catch.


More information about the Libraries mailing list