Ashley Yakeley wrote:

> At 2001-04-16 18:35, [EMAIL PROTECTED] wrote:
>
> >> Why (toRational 0.9) == (9 % 10) is False?
>
> I tried this in Hugs. It gives (toRational 0.9) as 7549747 % 8388608
> (i.e. 37748735/41943040 instead of 37748736/41943040 = 9/10).
>
> This is probably because Hugs attempts a floating-point approximation of
> the string "0.9" before passing it to a 'from' function (fromSingle,
> fromDouble) to cast it to 'Fractional a => a'.

Even though Hugs has this bug, you get the same behaviour even in
proper Haskell.  The reason is that the type of 0.9 gets defaulted to
Double (unless you've changed the default default).

    -- Lennart



_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to