
On Monday, 2003-07-07, 01:37, CEST, Andrew J Bromage wrote:
[...]
On Sat, Jul 05, 2003 at 07:43:18PM +0200, Steffen Mazanek wrote:
Prelude> 0.1::Rational 13421773 % 134217728
That's allowed. The Rational only has to be correct to the limit of machine precision. (Incidentally, if it's any help in working out how this Rational was computed, the denominator is 2^27.)
The Haskell 98 Report, ยง 6.4.1: Similarly, a floating literal stands for an application of fromRational to a value of type Rational (that is, Ratio Integer). This only talks about "*a* value of type Rational", not about how this value is choosen for a given literal. But since it's a Rational, the most natural way seems to calculate an exact value. For a literal a1 ... an.b1 ... bm, the value could be a1 ... anb1 ... bm % (10 ^ m). Why isn't this forced by the standard?
[...]
Wolfgang