William Stein wrote:
> sage: a = RIF(1/5)
> sage: a == a
> False
> sage: a is a
> True

That's how interval arithmetic usually works! Quoting from the 
documentation of real_mpfi:

| Comparison operations (``==``, ``!=``, ``<``, ``<=``, ``>``, ``>=``)
| return ``True`` if every value in the first interval has the given
| relation to every value in the second interval.
| [...]
| This convention for comparison operators has good and bad points.  
| [...]

> However,
> 
> sage: a.lower() == a.lower()
> True
> sage: a.upper() == a.upper()
> True
> 
> The code to compare intervals is here:
> 
> 
https://github.com/sagemath/sage/blob/master/src/sage/rings/real_mpfi.pyx#L3517
> 
> It looks like it just compares the endpoints, so I don't understand
> why a == a is false...

That's because you are looking at the wrong function; intervals also 
implement richcmp.

-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" 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-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to