Comparing RealIntervalField elements with floats

36 views
Skip to first unread message

Nathan Dunfield

unread,
Apr 10, 2021, 9:45:09 PM4/10/21
to sage-devel
In Sage 9.2 and earlier one has:

sage: RIF(1.0) < 2.0
True
sage: RIF(1.0, 3.0) < 2.0
False

but in Sage 9.3beta8 (most recent docker image) such comparisons raise the below exception. 

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-4b034be5c139> in <module>
----> 1 RIF(RealNumber('1.0')) < RealNumber('2.0')

~/sage/local/lib/python3.9/site-packages/sage/structure/element.pyx in sage.structure.element.Element.__richcmp__ (build/cythonized/sage/structure/element.c:10370)()
   1109             return (<Element>self)._richcmp_(other, op)
   1110         else:
-> 1111             return coercion_model.richcmp(self, other, op)
   1112 
   1113     cpdef _richcmp_(left, right, int op):

~/sage/local/lib/python3.9/site-packages/sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel.richcmp (build/cythonized/sage/structure/coerce.c:20790)()
   2004         # so we raise an exception.
   2005         if op == Py_LT:
-> 2006             raise bin_op_exception('<', x, y)
   2007         elif op == Py_LE:
   2008             raise bin_op_exception('<=', x, y)

TypeError: unsupported operand parent(s) for <: 'Real Interval Field with 53 bits of precision' and 'Real Field with 53 bits of precision'

Is this change intensional or is this a regression?  I noticed because some of SnapPy's doctests fail on 9.3beta8.

Thanks,

Nathan


Matthias Koeppe

unread,
Apr 10, 2021, 9:59:08 PM4/10/21
to sage-devel

Nathan Dunfield

unread,
Apr 10, 2021, 10:09:15 PM4/10/21
to sage-...@googlegroups.com
On Apr 10, 2021, at 8:59 PM, Matthias Koeppe <matthia...@gmail.com> wrote:
> Sounds like what is described in https://wiki.sagemath.org/ReleaseTours/sage-9.3#Numerics

Thanks, we will adjust SnapPy to match https://trac.sagemath.org/ticket/15114

Nathan
> --
> You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/_Ajyfl4qiSo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/862203f0-5025-41bb-a78a-25fac7165183n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages