#15501: AA should have .floor() method
-----------------------+----------------------------
   Reporter:  ppurka   |            Owner:
       Type:  defect   |           Status:  new
   Priority:  major    |        Milestone:  sage-6.1
  Component:  algebra  |         Keywords:
  Merged in:           |          Authors:
  Reviewers:           |  Report Upstream:  N/A
Work issues:           |           Branch:
     Commit:           |     Dependencies:
   Stopgaps:           |
-----------------------+----------------------------
 From google spreadsheet which no one reads `X-(`

 It happens that an algebraic number minus itself `(b-b)` is not printed as
 0, but something like `0.?e-18`. Usually it is not a big problem, because
 `b - b == 0` evaluates to `True`. But interestingly `floor(b-b)` is
 sometimes 0, sometimes a symbolic expression, so weird things can happen.

 {{{
 sage: a = QQbar((-1)^(1/4)).real()
 sage: floor(a-a) + a
 ---------------------------------------------------------------------------
 TypeError Traceback (most recent call last)
 <ipython-input-337-107a1ad8256f> in <module>()
 ----> 1 floor(a-a) + a

 /Applications/sage/local/lib/python2.7/site-
 packages/sage/structure/element.so in
 sage.structure.element.RingElement.__add__
 (sage/structure/element.c:13884)()

 /Applications/sage/local/lib/python2.7/site-
 packages/sage/structure/coerce.so in
 sage.structure.coerce.CoercionModel_cache_maps.bin_op
 (sage/structure/coerce.c:8169)()

 TypeError: unsupported operand parent(s) for '+': 'Symbolic Ring' and
 'Algebraic Real Field'
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/15501>
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 http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to