0

Possible Duplicate:
How did Python implement the built-in function pow()?

I was sifting through some of the developer docs and C code that python is written in and couldn't quite figure it out. At what level would this be defined? would it be in the C code that defines python or would it be in the assembler that C is built on? (is that what C is built on?).

To elaborate on the question a little there are a few ways to handle different mathematical operations and they vary in time complexity, I am trying to find out which algorithm python uses for modular exponentiation (if you know about the implementation of the other operations that would be great also).

I am looking specifically for the implementation details but any comments or resources about where this would be defined, or general thoughts on the matter would be appreciated.

Community
  • 1
  • 1
Jordan
  • 4,928
  • 4
  • 26
  • 39
  • It is a duplicate. Look for the function `long_pow` in the file Objects/longobject.c in the Python source distribution. – Omnifarious May 24 '11 at 21:02
  • @Sved Marnach, didn't see that, thanks! – Jordan May 24 '11 at 21:02
  • We resurrected the question because it's kind of helpful to have the duplicates lying around. Now if someone searches for modular exponentiation, they find this question that references the question about the implementation of `pow`. – Omnifarious May 26 '11 at 12:15

0 Answers0