Usage
binaryExponentiation(a, n)
binaryExponentiation!(a, n)
Signature
binaryExponentiation: (T, Z) T
Parameter | Type | Description |
---|---|---|
a | T | The element to exponentiate |
n | Z | The exponent |
Returns
Returns . The exponent must be nonnegative. When using binaryExponentiation!(), 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!() 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.