#10217: bug in rings/fast_arith.pyx
-----------------------------------------------+----------------------------
       Reporter:  was                          |         Owner:  AlexGhitza     
            
           Type:  defect                       |        Status:  
positive_review            
       Priority:  minor                        |     Milestone:  sage-5.0       
            
      Component:  basic arithmetic             |    Resolution:                 
            
       Keywords:                               |   Work issues:                 
            
Report Upstream:  N/A                          |     Reviewers:  Mike Hansen, 
Andre Apitzsch
        Authors:  Mike Hansen, Andre Apitzsch  |     Merged in:                 
            
   Dependencies:                               |      Stopgaps:                 
            
-----------------------------------------------+----------------------------
Changes (by aapitzsch):

  * status:  needs_work => positive_review
  * reviewer:  => Mike Hansen, Andre Apitzsch


Old description:

> This chunk of code in fast_arith.pyx:
>
> {{{
>
>     cdef public long long c_inverse_mod_longlong(self, long long a, long
> long m) except -1:
>         cdef long long g, s, t
>         g = self.c_xgcd_longlong(a,m, &s, &t)
>         s = s % m
>         if s < 0:
>             s = s + m
>         return s
> }}}
> should raise an exception if g != 1, so should be
>
> {{{
>
>     cdef public long long c_inverse_mod_longlong(self, long long a, long
> long m) except -1:
>         cdef long long g, s, t
>         g = self.c_xgcd_longlong(a,m, &s, &t)
>         if g != 1: raise ZeroDivisionError
>         s = s % m
>         if s < 0:
>             s = s + m
>         return s
> }}}
> '''Apply''' attachment:trac_10217_merged.patch

New description:

 This chunk of code in fast_arith.pyx:

 {{{

     cdef public long long c_inverse_mod_longlong(self, long long a, long
 long m) except -1:
         cdef long long g, s, t
         g = self.c_xgcd_longlong(a,m, &s, &t)
         s = s % m
         if s < 0:
             s = s + m
         return s
 }}}
 should raise an exception if g != 1, so should be

 {{{

     cdef public long long c_inverse_mod_longlong(self, long long a, long
 long m) except -1:
         cdef long long g, s, t
         g = self.c_xgcd_longlong(a,m, &s, &t)
         if g != 1: raise ZeroDivisionError
         s = s % m
         if s < 0:
             s = s + m
         return s
 }}}
 Apply only [attachment:trac_10217_rebased.patch]

--

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