#15260: Floor (integer) division of reals and rationals
-------------------------------------+-------------------------------------
       Reporter:  ncohen             |        Owner:
           Type:  defect             |       Status:  needs_review
       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:
-------------------------------------+-------------------------------------
Changes (by jdemeyer):

 * status:  needs_work => needs_review


Old description:

> As reported there [1]
>
> {{{
> sage: x = 1/2
> sage: x//2
> 1/4
> sage: RDF(5) // 2
> 2.5
> sage: RIF(5) // 2
> TypeError: unsupported operand type(s) for //:
> 'sage.rings.real_mpfi.RealIntervalFieldElement' and
> 'sage.rings.real_mpfi.RealIntervalFieldElement'
> }}}
>
> This ticket will fix floor division for these types, see also #2034 for
> implementing a generic `__floordiv__`.
>
> [1] https://groups.google.com/d/topic/sage-support/xE_S3WbFHzA/discussion

New description:

 As reported in [1] and [2]

 {{{
 sage: x = 1/2
 sage: x//2
 1/4
 sage: RDF(5) // 2
 2.5
 sage: RIF(5) // 2
 TypeError: unsupported operand type(s) for //:
 'sage.rings.real_mpfi.RealIntervalFieldElement' and
 'sage.rings.real_mpfi.RealIntervalFieldElement'
 sage: QQ(7) // QQ(3)
 7/3
 }}}

 [1] https://groups.google.com/d/topic/sage-support/xE_S3WbFHzA/discussion
 [2] https://groups.google.com/d/msg/sage-devel/nQDAMtqnEsY/HfpIdvc9AwAJ

--

Comment:

 Replying to [comment:25 vdelecroix]:
 > I do not agree with your semantic of `__floordiv__`.

 It's consistent with Python's `__floordiv__` for `float`, so this what we
 should do according to the "principle of least surprise".

--
Ticket URL: <http://trac.sagemath.org/ticket/15260#comment:28>
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.

Reply via email to