Sat, 05 Jul 2003 20:24:32 +0100
On 2003-07-05 at 19:43+0200 Steffen Mazanek wrote:
> a quit funny hugs session:
> Prelude> 0.5::Rational
> 1 % 2
> Prelude> 0.1::Rational
> 13421773 % 134217728
> Prelude> 13421773/134217728
> I do not know how this fraction is calculated, but
> it does not fit my expectations :-)
Remember that internally arithmetic is binary, and that 0.1
can't be expressed exactly as a floating point number. I
think that's the explanation.
> Ok, ok, it is no bug...
No, I think it is a bug: 0.1 ought to be equivalent to
fromRational (1%10), but Hugs isn't intended for numerical
work. GHCi gets the right answer.
Jón Fairbairn Jon.Fairbairn@cl.cam.ac.uk