#12149: float('nan')>1 crashes Sage.
--------------------------------+-------------------------------------------
   Reporter:  was               |          Owner:  AlexGhitza   
       Type:  defect            |         Status:  needs_review 
   Priority:  critical          |      Milestone:  sage-4.8     
  Component:  basic arithmetic  |       Keywords:               
Work_issues:                    |       Upstream:  N/A          
   Reviewer:                    |         Author:  William Stein
     Merged:                    |   Dependencies:               
--------------------------------+-------------------------------------------

Comment(by SimonKing):

 I tried
 {{{
                 try:
                     sig_on()
                     c = mpz_cmp_d((<Integer>left).value,
 PyFloat_AsDouble(right))
                     sig_off()
                 except RuntimeError:
                     sig_off()
                     return False
 }}}
 but when I test it, then the error is not silently caught. Instead, I get:
 {{{
 sage: a = float('nan'); b = 1
 sage: a<b, a>b, b<a, b>a
 
/mnt/local/king/SAGE/rebase/sage-4.8.alpha3/local/lib/libcsage.so(print_backtrace+0x31)[0x7fdb346132d0]
 
/mnt/local/king/SAGE/rebase/sage-4.8.alpha3/local/lib/libcsage.so(_sig_off_warning+0x6f)[0x7fdb34613050]
 /mnt/local/king/SAGE/rebase/sage-4.8.alpha3/local/lib/python2.6/site-
 packages/sage/rings/integer.so(+0x2a0ba)[0x7fdb2ca390ba]
 
/mnt/local/king/SAGE/rebase/sage-4.8.alpha3/local/lib/libpython2.6.so.1.0(PyObject_RichCompare+0x61)[0x7fdb39c538b1]
 
/mnt/local/king/SAGE/rebase/sage-4.8.alpha3/local/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x3355)[0x7fdb39cb11d5]
 ...
 
/mnt/local/king/SAGE/rebase/sage-4.8.alpha3/local/lib/libpython2.6.so.1.0(PyRun_FileExFlags+0xb0)[0x7fdb39cd4c90]
 
/mnt/local/king/SAGE/rebase/sage-4.8.alpha3/local/lib/libpython2.6.so.1.0(PyRun_SimpleFileExFlags+0xdc)[0x7fdb39cd4e5c]
 
/mnt/local/king/SAGE/rebase/sage-4.8.alpha3/local/lib/libpython2.6.so.1.0(Py_Main+0xb36)[0x7fdb39ce2186]
 /lib/libc.so.6(__libc_start_main+0xfd)[0x7fdb38fe0c4d]
 python[0x400699]
 (False, False, False, False)
 }}}

 What did I do wrong?

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