#12149: float('nan')>1 crashes Sage.
--------------------------------+-------------------------------------------
Reporter: was | Owner: AlexGhitza
Type: defect | Status: new
Priority: critical | Milestone: sage-4.8
Component: basic arithmetic | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
--------------------------------+-------------------------------------------
The optimizations in #10314 ignored the fact that floating point numbers
can be nan, which leads to it being trivial to completely crash Sage. I
ran into exactly this when doing real work, so I'm annoyed.
{{{
sage: float('nan') > 1
Program received signal SIGFPE, Arithmetic exception.
0x00007fff89c3b82a in __kill ()
(gdb) bt
#0 0x00007fff89c3b82a in __kill ()
#1 0x00000001013c530e in __gmp_invalid_operation ()
#2 0x00000001013cf579 in __gmpz_cmp_d ()
#3 0x00000001035fd09e in
__pyx_pf_4sage_5rings_7integer_7Integer_7__richcmp__ (__pyx_v_left=0x5bd7,
__pyx_v_right=0x10b2a0470, __pyx_v_op=0) at integer.c:7855
}}}
The traceback points to this code integer.pyx:
{{{
elif PyFloat_CheckExact(left):
c = -mpz_cmp_d((<Integer>right).value,
PyFloat_AsDouble(left))
}}}
There is similar code a few lines down for the other direction, hence this
also crashes
{{{
sage: 1 < float('nan')
Unhandled SIGFPE:
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12149>
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.