#12353: wrong comparison between RealIntervalField and RealField
--------------------------------+-------------------------------------------
   Reporter:  zimmerma          |          Owner:  AlexGhitza
       Type:  defect            |         Status:  new       
   Priority:  blocker           |      Milestone:  sage-5.0  
  Component:  basic arithmetic  |       Keywords:            
Work_issues:                    |       Upstream:  N/A       
   Reviewer:                    |         Author:            
     Merged:                    |   Dependencies:            
--------------------------------+-------------------------------------------

Comment(by fbissey):

 Are we talking about this piece of code (line 840)
 {{{
             except (TypeError, NotImplementedError):
                 r = cmp(type(left), type(right))
                 if r == 0:
                     r = -1
 }}}
 As far as I know comparing type when you cannot compare the values is
 standard python behavior and is implemented in other places such as
 sets/set.py
 {{{
     def __cmp__(self, right):
         r"""
         Compare self and right.

         If right is not a Set compare types.  If right is also a Set,
         returns comparison on the underlying objects.

         .. note::

            If `X < Y` is true this does *not* necessarily mean
            that `X` is a subset of `Y`.  Also, any two sets can be
            compared still, but the result need not be meaningful
            if they are not equal.

         EXAMPLES:
             sage: Set(ZZ) == Set(QQ)
             False
             sage: Set(ZZ) < Set(QQ)
             True
             sage: Primes() == Set(QQ)
             False

         The following is random, illustrating that comparison of
         sets is not the subset relation, when they are not equal::

             sage: Primes() < Set(QQ)             # random
             True or False
         """
         if not isinstance(right, Set_object):
             return cmp(type(self), type(right))
         return cmp(self.__object, right.__object)
 }}}
 The comparison of type can be machine dependent as far as I remember which
 explain the inconsistencies. I guess it would be nice to try to get
  * a better answer
  * a better comparison

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

Reply via email to