toRational (0.9). Reply

Lennart Augustsson
Wed, 18 Apr 2001 14:01:17 +0200

Jerzy Karczmarczuk wrote:

> Lennart Augustsson wrote:
> > "S.D.Mechveliani" wrote:
> ...                 ...
> > > Probably, the source of a `bug' is a language agreement that the
> > > input is in decimal representation (`0.9') and its meaning is a
> > > floating approximation in _binary_ representation.
> >
> > What are you talking about?  Input in decimal representation is
> > stored as a Rational number.  There is absolutely no loss of
> > precision.
> No need for whatareyoutalkingabout preamble.
> Input in decimal representation *in general* is stored as the
> implementors wish. You can't a priori know all, if you are far
> from the implementors, and if the relevant documentation is
> hard to find... How many people on this mailing list are really
> au courant?

I apologize for the preamble.  But the Haskell spec still clearly
specifies that numeric literals are "stored" as Integer if they lack
a decimal point and Rational otherwise.  And the fromInteger/fromRational
is applied to this.  For Haskell there is no implementors choice
if you want to obey the report.

    -- Lennart