
28 Aug
2001
28 Aug
'01
6:14 a.m.
Today's other question has to do with numeric literals. How do I write literals for interesting IEEE values, e.g.
Prelude> x Infinity Prelude> :type x Double Prelude> (read "Infinity") :: Double *** Exception: Ratio.%: zero denominator Prelude>
This looks like a bug in GHC, which has now been fixed for version 5.02. Note that Haskell leaves the behaviour of these exceptional conditions undefined. Hugs for example will give a program error on divide by zero, and NHC has even more interesting behaviour: Prelude> 1/0 :: Float 34.02823669209384634633746074317682114560000000 Cheers, Simon