The operands will coerce to RR, so you are essentially asking why there is no floordiv there.
I'd say its an oversight. Presumably not very many people use it. But there is a mpfr_remainder() that we could wrap. On Friday, October 3, 2014 9:48:02 PM UTC+1, João Alberto Ferreira wrote: > > Hi! I was experimenting with floor division in Sage using the int and > float types of Python and Integeger and RealNumber types of Sage to > understand the differences. I've found that the floor division operator > (//) in Sage does not support real numbers. Is there a reason for this? (I > ask just for curiosity) > > > int(5)//float(2.0), int(5)//float(-2.0) > > (2.0, -3.0) > > > ZZ(5)//RR(2.0), ZZ(5)//RR(-2.0) > > Error in lines 1-1 > Traceback (most recent call last): > File > "/projects/cb65bb5e-3452-4325-988a-501d0b395e0b/.sagemathcloud/sage_server.py", > line 828, in execute > exec compile(block+'\n', '', 'single') in namespace, locals > File "", line 1, in <module> > File "integer.pyx", line 1868, in sage.rings.integer.Integer.__floordiv__ > (build/cythonized/sage/rings/integer.c:14174) > File "element.pyx", line 3013, in sage.structure.element.bin_op > (build/cythonized/sage/structure/element.c:23330) > File "element.pyx", line 3015, in sage.structure.element.bin_op > (build/cythonized/sage/structure/element.c:23225) > File "coerce.pyx", line 799, in > sage.structure.coerce.CoercionModel_cache_maps.bin_op > (build/cythonized/sage/structure/coerce.c:7575) > File "coerce.pyx", line 795, in > sage.structure.coerce.CoercionModel_cache_maps.bin_op > (build/cythonized/sage/structure/coerce.c:7520) > TypeError: unsupported operand type(s) for //: > 'sage.rings.real_mpfr.RealNumber' and 'sage.rings.real_mpfr.RealLiteral' > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
