Ask Your Question

Revision history [back]

Why .45 // .28 does not work?

Taking modulo works with Python float and Sage float:

sage: .45r % .28r
0.16999999999999998
sage: .45 % .28
-0.110000000000000

The quotient works with Python float:

sage: .45r // .28r
1.0

But why should it not work with Sage float as well?

sage: .45 // .28
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for //: 'Real Field with 53 bits of precision' and 'Real Field with 53 bits of precision'