#4850: bug in power_mod
------------------------------+---------------------------------------------
 Reporter:  was               |        Owner:  somebody  
     Type:  defect            |       Status:  new       
 Priority:  major             |    Milestone:  sage-3.2.3
Component:  basic arithmetic  |   Resolution:            
 Keywords:                    |  
------------------------------+---------------------------------------------
Comment (by burcin):

 I suggest we remove the `power_mod` function completely, since python
 already supports this.

 {{{
 sage: pow?
 Type:           builtin_function_or_method
 Base Class:     <type 'builtin_function_or_method'>
 String Form:    <built-in function pow>
 Namespace:      Python builtin
 Docstring:
     pow(x, y[, z]) -> number

     With two arguments, equivalent to x**y.  With three arguments,
     equivalent to (x**y) % z, but may be more efficient (e.g. for longs).
 Class Docstring:
     <attribute '__doc__' of 'builtin_function_or_method' objects>
 }}}

 This would call the `__pow__` method of the function in question with the
 right arguments, so we can handle the modulo powering operation in the
 right place. Recall that the signature of the `__pow__` method is
 actually:

 {{{
 __pow__(self, other[, modulus]).
 }}}


 So the objective of this ticket should be changed to:
  * let `sage.structure.element.generic_power_c` handle modulus arguments
  * change the `__pow__` methods in sage.structure.element to accept and
 pass on the third argument
  * deprecate `sage.rings.arith.power_mod`
  * deprecate `Integer.powermod`

 Thoughts?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4850#comment:1>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
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