Node:Normal Powering Algorithm, Next:Modular Powering Algorithm, Previous:Powering Algorithms, Up:Powering Algorithms
Normal mpz
or mpf
powering uses a simple binary algorithm,
successively squaring and then multiplying by the base when a 1 bit is seen in
the exponent, as per Knuth section 4.6.3. The "left to right"
variant described there is used rather than algorithm A, since it's just as
easy and can be done with somewhat less temporary memory.