#15260: Floor (integer) division of reals and rationals
-------------------------------------+-------------------------------------
Reporter: ncohen | Owner:
Type: defect | Status: needs_info
Priority: major | Milestone: sage-7.1
Component: basic arithmetic | Resolution:
Keywords: | Merged in:
Authors: Jan Keitel, | Reviewers: Jeroen Demeyer,
Jeroen Demeyer | Thierry Monteil
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/jdemeyer/ticket/15260 | 616f88c009990bd9d778970ac2bb3496e500b1a1
Dependencies: #2034 | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by bruno):
By the principle of least surprise, I would be in favor of
`QQ.__floordiv__` behaving the same way as `float.__floordiv__` behaves in
Python. Another reason for `__floordiv__` to be internal is that it gives
a generic "exact division" method (division while you know in advance that
the result is exact), which has several use cases. For instance if you
want to take the primitive part of a polynomial: You can write a generic
method which works over fields as well as over rings, as soon as you have
a method `content` which returns 1 for fields and a more interesting
content for rings.¹ In a situation where `__floordiv__` raises an
Exception, you must use a `__truediv__` and then convert to the original
ring to obtain an exact division.
¹ This example may seem anecdotal though I constantly encounter the need
for an exact division. Of course, this is only useful for generic
implementation, which could be used with rings or fields.
--
Ticket URL: <http://trac.sagemath.org/ticket/15260#comment:32>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" 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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.