next up previous contents index
Next: Boolean Up: BinaryPowering Previous: BinaryPowering   Contents   Index


binaryExponentiation


Usage

binaryExponentiation(a, n)
binaryExponentiation!(a, n)


Signature

binaryExponentiation: (T, Z) $\to$ T


Parameter Type Description
a T The element to exponentiate
n Z The exponent


Returns

Returns $a^n$. The exponent $n$ must be nonnegative. When using binaryExponentiation!($a, n$), the storage used by a and n is allowed to be destroyed or reused, so a and n are lost after this call.


Remarks

A call to binaryExponentiation!($a, n$) may cause a and n to be destroyed, so do not use it unless a and n have been locally allocated, and are guaranteed not to share space with other elements. Some functions are not necessarily copying their arguments and can thus create memory aliases.



Manuel Bronstein 2004-06-28