Sage automatically/unnecessarily rounds ratio of two integers inside double loop.

30 Views Asked by At

I am not very familiar with Sage so maybe it is obvious.

Input to Sage:

i=3;
j=2;
print(i/j);
for i in range(3,4):
      for j in range(2,3):
            print(i/j);

Output from Sage:

3/2
1

First output is as expected $3/2$, but why the second output is not also $3/2$ but it is rounded to $1$?

I want to loop over rationals - over numerators and over denominators, but the rounding makes it impossible.

EDIT: Solved using srange instead of range.

Input to Sage:

i=3;
j=2;
print(i/j);
for i in srange(3,4):
      for j in srange(2,3):
            print(i/j);

Output from Sage:

3/2
3/2