#10314: speed up comparison of Integers and native Python numeric types
--------------------------------+-------------------------------------------
   Reporter:  roed              |       Owner:  AlexGhitza
       Type:  enhancement       |      Status:  needs_work
   Priority:  major             |   Milestone:  sage-4.6.1
  Component:  basic arithmetic  |    Keywords:            
     Author:  David Roe         |    Upstream:  N/A       
   Reviewer:                    |      Merged:            
Work_issues:                    |  
--------------------------------+-------------------------------------------

Comment(by roed):

 Thanks for catching that.  I don't know why my test -1.5r < 3 didn't crash
 horribly...

 I've switched to using the mpz_tmp as you suggested.

 On adding some more tests, I've discovered that this patch changes the
 behavior of comparison of large floats to sage integers.  Now we have
 {{{
 sage:
 
1000000000000000000000000000000000000000000000000000.0r==1000000000000000000000000000000000000000000000000000
 False
 }}}
 whereas it was True before.  Of course, before
 {{{
 sage:
 
1000000000000000000000000000000000000000000000000000.1r==1000000000000000000000000000000000000000000000000000
 True
 }}}

 I think it's still worth using `mpz_cmp_d` because of the speed benefit;
 users should know to be careful with these kinds of floating point
 comparisons.  Do you agree?

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