With GHC-5.02.2, I do
$ ghci
Prelude :m Ratio
Ratio [1%2..10%2]
[1 % 2,3 % 2,5 % 2,7 % 2,9 % 2,11 % 2]
The question is, why is there 11%2 at the end of the list?
It's inconsistent with the (good) rules for Integer, since
Ratio [1,3..10]
[1,3,5,7,9]
Is this intentional?
Ferenc Wagner [EMAIL PROTECTED] writes:
$ ghci
Prelude :m Ratio
Ratio [1%2..10%2]
[1 % 2,3 % 2,5 % 2,7 % 2,9 % 2,11 % 2]
H, the CVS copy of Hugs seems to suffer from a different problem:
Prelude [0.5,1.5..5.5]::[Rational]
[0 % 1,1 % 1,2 % 1,3 % 1,4 % 1,5 % 1]
I'm expecting to see:
[1 %
Alastair Reid:
Ferenc Wagner [EMAIL PROTECTED] writes:
H, the CVS copy of Hugs seems to suffer from a different problem:
Prelude [0.5,1.5..5.5]::[Rational]
[0 % 1,1 % 1,2 % 1,3 % 1,4 % 1,5 % 1]
I'm expecting to see:
[1 % 2,3 % 2,5 % 2,7 % 2,9 % 2,11 % 2]
Rationals in Hugs were
]
| Subject: Rational sequence
|
| With GHC-5.02.2, I do
|
| $ ghci
| Prelude :m Ratio
| Ratio [1%2..10%2]
| [1 % 2,3 % 2,5 % 2,7 % 2,9 % 2,11 % 2]
|
| The question is, why is there 11%2 at the end of the list?
| It's inconsistent with the (good) rules for Integer, since
|
| Ratio [1,3..10]
| [1,3,5,7,9
Simon Peyton-Jones [EMAIL PROTECTED] writes:
The Report says that the Enum instance for Ratio uses the
same rule as for Float/Double,
Now I can see that the revised Report contains more about
this than the one on haskell.org. But I still can't see the
statement you cited above. Where should
Jerzy Karczmarczuk [EMAIL PROTECTED] writes:
Rationals in Hugs were always a bit obscure. What do you think, what
is the Rational form of 2.3 ? (GHCi says 23/10).
The answer is:
2589569785738035 % 1125899906842624
(Old Hugs, Feb. 2001)
I'm afraid the new release won't fix this.
Once
Jerzy Karczmarczuk wrote (on 22-10-02 13:05 +0200):
What do you think, what
is the Rational form of 2.3 ? (GHCi says 23/10).
The answer is:
2589569785738035 % 1125899906842624
Er, why?
Because 2.3 is not representable using a double precision float or something?
--
Frank
Frank Atanassow wrote (on 22-10-02 15:08 +0200):
Jerzy Karczmarczuk wrote (on 22-10-02 13:05 +0200):
What do you think, what
is the Rational form of 2.3 ? (GHCi says 23/10).
The answer is:
2589569785738035 % 1125899906842624
Er, why?
Because 2.3 is not representable using a