toRational (0.9)

Lennart Augustsson [email protected]
Wed, 18 Apr 2001 14:05:56 +0200


"S.D.Mechveliani" wrote:

> he matter is in what the _language standard_ says.
> If it puts that `0.9' in the user program means precizely  9%10,
> then Lennart is right.

I quote the report:

"The floating point literal f is equivalent to fromRational (n Ratio.% d), where fromRational is a
 method in class Fractional and Ratio.% constructs a rational from
 two integers, as defined in the Ratio library. The integers n and d are chosen so that n/d = f."

I think the way Haskell handles numeric literals is pretty nice and it's
important to understand what happens if you use them. :)

    -- Lennart