#10161: AlgebraicNumber comparisons wrong/fail
-----------------------------+----------------------------------------------
Reporter: vbraun | Owner: was
Type: defect | Status: new
Priority: major | Milestone:
Component: number theory | Keywords:
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-----------------------------+----------------------------------------------
Comparing `AlgebraicNumber` with `Integer` or `Rational` can lead to
unexpected results:
{{{
sage: x = Integer(1)
sage: y = Rational(1,1)
sage: z = AlgebraicNumber(1)
sage: ( x==y, y==z, x==y ) # so far, so good
(True, True, True)
sage: ( set([x,y]), set([x,z]), set([y,z]) ) # what?
(set([1]), set([1, 1]), set([1, 1]))
sage: for i in (x,y,z):
....: for j in (x,y,z):
....: print i._cmp_(j) # i think this is the culprit
....:
0
0
1
1
0
1
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call
last)
/home/vbraun/Sage/patches/<ipython console> in <module>()
/home/vbraun/Sage/sage/local/lib/python2.6/site-
packages/sage/structure/element.so in sage.structure.element.Element._cmp_
(sage/structure/element.c:5842)()
/home/vbraun/Sage/sage/local/lib/python2.6/site-
packages/sage/structure/element.so in
sage.structure.element.Element._cmp_c_impl
(sage/structure/element.c:7336)()
NotImplementedError: BUG: sort algorithm for elements of 'Integer Ring'
not implemented
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10161>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.