Numbers again

Konrad Hinsen hinsen@cnrs-orleans.fr
Fri, 22 Aug 2003 18:39:43 +0200


I am getting a bit worried about the usability of Haskell for numerical w=
ork.=20
The Haskell 98 report states that floating literals are represented as a=20
conversion from Rational, which means that the literal is first converted=
 to=20
a Rational. I can't find anything in the Haskell report that states how t=
his=20
conversion should take place, and to what precision it should be correct.=
 It=20
could be made correct to any precision as Rationals are represented using=
=20
Integers, but at least Hugs doesn't do that. By experimenting with some=20
particular cases, I found that its internal Rational representation is ev=
en=20
less accurate than the precision of Double permits, which means that it i=
s=20
impossible to specify literals to the full precision of Double. GHC behav=
ed=20
fine in my tests. But what can I safely assume from a Haskell implementat=
ion?

Konrad.