Hugs Humor

Wolfgang Jeltsch wolfgang@jeltsch.net
Mon, 7 Jul 2003 12:38:48 +0200


On Monday, 2003-07-07, 01:37, CEST, Andrew J Bromage wrote:
> [...]

> On Sat, Jul 05, 2003 at 07:43:18PM +0200, Steffen Mazanek wrote:
> > Prelude> 0.1::Rational
> > 13421773 % 134217728
>
> That's allowed.  The Rational only has to be correct to the limit of mach=
ine
> precision.  (Incidentally, if it's any help in working out how this Ratio=
nal
> was computed, the denominator is 2^27.)

The Haskell 98 Report, =A7 6.4.1:
    Similarly, a floating literal stands for an application of fromRational=
 to
    a value of type Rational (that is, Ratio Integer).
This only talks about "*a* value of type Rational", not about how this valu=
e=20
is choosen for a given literal. But since it's a Rational, the most natural=
=20
way seems to calculate an exact value. For a literal a1 ... an.b1 ... bm, t=
he=20
value could be a1 ... anb1 ... bm % (10 ^ m). Why isn't this forced by the=
=20
standard?

> [...]

Wolfgang