Numeric literals
Simon Marlow
simonmar@microsoft.com
Tue, 28 Aug 2001 11:14:41 +0100
> Today's other question has to do with numeric literals. How do I write
> literals for interesting IEEE values, e.g.
>=20
> Prelude> x
> Infinity
> Prelude> :type x
> Double
> Prelude> (read "Infinity") :: Double
> *** Exception: Ratio.%: zero denominator
> Prelude>=20
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