Comparison of exceptional IEEE floating point numbers, like Nan, seems to have some bugs in ghci (version 6.12.1).
These are correct, according to the IEEE floating point standards: Prelude> 0 < (0/0) False Prelude> 0 > (0/0) False Prelude> 0 == (0/0) False But these are inconsistent with the above, and arguably incorrect: Prelude> compare (0/0) (0/0) GT Prelude> compare (0/0) 0 GT Prelude> compare 0 (0/0) GT Prelude> compare (0/0) (1/0) GT Prelude> compare (1/0) (0/0) GT I'd suggest that compare involving a NaN should yield error "violation of the law of the excluded middle" The min and max functions have strange behaviour with regard to NaN, especially when mixed with Infinity: Prelude> max (0/0) (1/0) NaN Prelude> max (1/0) (0/0) Infinity Prelude> min (0/0) (1/0) Infinity Prelude> max (0/0) 0 NaN Prelude> max 0 (0/0) 0.0 Hugs (Version: September 2006) has similar issues: Hugs> compare (0/0) (0/0) EQ Hugs> compare (0/0) 1 EQ Hugs> (0/0) == (0/0) False Hugs> min (0/0) 1 nan Hugs> min 1 (0/0) 1.0 Hugs> max (0/0) 1 1.0 Discuss? -- Barak A. Pearlmutter <ba...@cs.nuim.ie> Hamilton Institute & Dept Comp Sci, NUI Maynooth, Co. Kildare, Ireland http://www.bcl.hamilton.ie/~barak/ _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe