Jerzy Karczmarczuk <karczma@info.unicaen.fr> writes | 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. | [..] The 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. As I never used such things like `0.9', I would take, so far, what the language experts say. ----------------- Serge Mechveliani mechvel@botik.ru
"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
participants (2)
-
Lennart Augustsson -
S.D.Mechveliani