Ask Your Question

Revision history [back]

You can try;

sage: QQ(1.5)
3/2

You can try;try:

sage: QQ(1.5)
3/2

or:

sage: (1.5).exact_rational()
3/2

You can try:

sage: QQ(1.5)
3/2

or:

sage: (1.5).exact_rational()
3/2

As a warning, i let you undertand the following behaviour with decimal numbers:

sage: (1.1).exact_rational()
2476979795053773/2251799813685248