PowerMod

New to Analytica 6.0

PowerMod( base, exponent, modulus )

Computes Mod(base^exponent, modulus, true) where all parameters are non-negative integers and «modulus» is positive. The result is between 0 and modulus-1 inclusive. If any parameter is not an integer, it is rounded to the nearest non-zero integer first. All the integers can be between -2^63 and 2^63 (i.e., the range that is exactly represented as an integer by Analytica).

If you try to compute this using the logically equivalent expression, Mod(base^exponent,modulus,true), when the term base^exponent exceeds 2^63, floating-point operations would introduce round-off error resulting in an incorrect result. The PowerMod function computes the exact integer result.

See Also

Comments


You are not allowed to post comments.