Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Integer result for fraction

Hi!

Can somebody explain me this strange behavior of Sage :

for p in range(1,10):
    for q in range(1,10):
        print p/q

Then p/q return the integer division.

However:

for p in range(1,10):
    print p/7

give rational results.

A solution is to use Rational(p)/Rational(q) instead of p/q. But it is not an explanation.

Thanks,

Arnaud