Numeric literals

Mark Carroll
Tue, 28 Aug 2001 08:29:33 -0400 (EDT)

On Tue, 28 Aug 2001, Simon Marlow wrote:
> 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


Damn - that's annoying. I've come to take the existence of reasonable IEEE
754 floating point support for granted - is it really generally that bad
in Haskell? Are there any libraries and whatnot that will help fix this? I
like at least for plus and minus infinities and NaNs to be part of things.
(-: My first thought was to learn about the FFI and do actual arithmetic
and the relevant reading and showing in another language that I link with,
but I fear the speed penalty, and now I think about it I might be able to
reasonably transparently deal with the cases I care about in pure Haskell.

I also haven't yet worked out how to tell if a string is "read"able or
not, yet - if (read "45")::Integer or whatever gives an error (e.g. if I'd
put "af" instead of "45"), it seems to be pretty uncatchable, which is a
pain. How do I tell if an instance of reading will work, or catch that it 

I know things must be better than this - I must be missing something? (-:

-- Mark