> [EMAIL PROTECTED] reports the following problem.
>
> The value of the expression 
>
>   1.2 :: Rational
>
> should be exactly 6 % 5.
>
> However, apparently hugs represents the literal 1.2 first 
> by a floating point value, which is then approximated by
> a rational number, thus introducing unnecessary round-off 
> error. This is the behaviour one should (and does) get from
> the expression
> toRational 1.2
> 
> Prelude> 1.2 :: Rational
> 5033165 % 4194304
> Prelude> toRational 1.2
> 5033165 % 4194304

Yoiks, I didn't realise it was that fragile.

I've recently been toying with representing of Integer and Rational
 literals by strings all the way through the compiler to the code 
 generator.  This looks like a very good reason to do so.

Alastair



Reply via email to