#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):

 Replying to [comment:10 jdemeyer]:
 > Replying to [comment:7 SimonKing]:
 > > It is wrong to use sig_on/sig_off in comparison code without "try-
 except".
 > Why is that?

 Because comparison in Python must not result in an error, if I remember
 correctly the Python specifications.

 Here are timings, using `a = 1, b = 2, c = 1".

 Vanilla sage-4.8.alpha3:
 {{{
 sage: timeit("a==b",number=10^5)
 100000 loops, best of 3: 271 ns per loop
 sage: timeit("a==c",number=10^5)
 100000 loops, best of 3: 268 ns per loop
 sage: timeit("a==x",number=10^5)
 100000 loops, best of 3: 13.8 µs per loop
 }}}

 William's patch:
 {{{
 sage: timeit("a==b",number=10^5)
 100000 loops, best of 3: 260 ns per loop
 sage: timeit("a==c",number=10^5)
 100000 loops, best of 3: 266 ns per loop
 sage: timeit("a==x",number=10^5)
 100000 loops, best of 3: 14.7 µs per loop
 }}}

 try-sigon-sigoff-except:
 {{{
 sage: timeit("a==b",number=10^5)
 100000 loops, best of 3: 272 ns per loop
 sage: timeit("a==c",number=10^5)
 100000 loops, best of 3: 266 ns per loop
 sage: timeit("a==x",number=10^5)
 100000 loops, best of 3: 13.6 µs per loop
 }}}

 So, it is not really that much of a difference.

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