compare on Double

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Mar 20 11:53:58 EDT 2007


Ian Lynagh <igloo at earth.li> wrote:

>     (D# x) `compare` (D# y) | x <## y   = LT
>                             | x ==## y  = EQ
>                             | otherwise = GT
> 
> becomes
> 
>     (D# x) `compare` (D# y) | x <## y   = LT
>                             | x ==## y  = EQ
>                             | x >## y   = GT
>                             | otherwise = error "Incomparable values"

I'm pretty uncomfortable with calling 'error' in this situation.  How
about throwing an imprecise exception instead?

Regards,
    Malcolm


More information about the Libraries mailing list