#5047: [with patch, needs review] comparing complex i raises error
------------------------------+---------------------------------------------
 Reporter:  burcin            |        Owner:  somebody
     Type:  defect            |       Status:  new     
 Priority:  major             |    Milestone:  sage-3.3
Component:  basic arithmetic  |   Resolution:          
 Keywords:                    |  
------------------------------+---------------------------------------------
Changes (by SimonKing):

  * summary:  comparing complex i raises error => [with patch, needs
              review] comparing complex i raises error

Comment:

 Replying to [comment:1 SimonKing]:
 > In Python, one gets
 > {{{
 > >>> cmp(1j,0)
 > Traceback (most recent call last):
 >   File "<stdin>", line 1, in <module>
 > TypeError: no ordering relation is defined for complex numbers
 > }}}

 With the patch, one gets
 {{{
 sage: cmp(i,0)
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /home/king/.sage/temp/mpc739/25379/_home_king__sage_init_sage_0.py in
 <module>()
 ----> 1
       2
       3
       4
       5

 /home/king/SAGE/devel/sage-3.2.1/local/lib/python2.5/site-
 packages/sage/functions/functions.pyc in __cmp__(self, right)
     270             c = cmp(R(self), R(right))
     271         except TypeError:
 --> 272             raise TypeError, "these objects are not comparable"
     273         if c: return c
     274         try:

 TypeError: these objects are not comparable
 }}}
 which, I believe, is consistent with python.

 Other comparisons still work:
 {{{
 sage: cmp(i^2,0)
 -1
 sage: cmp(e,0)
 1
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5047#comment:2>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to