up previous next
Let A and B be integers. The expression
A%B has type
ZMOD and
represents the class of A modulo B. The integer B should be greater
than 0 and less then
32767 = 2^{15}  1.
When a modular integer is evaluated by CoCoA, it is reduced to a
canonical form
A%B with
B/2 < A <= B/2.
Two modular integers of the form
A%C and
B%C are said to be
compatible, and the usual arithmetical operations are applicable.
3%7;
3 % 7

4%7;
3 % 7

2%5 + 4%5;
1 % 5

Type(3%11);
ZMOD

3%11 = 14%11;
TRUE

3%11 * 3;
2 % 11

3%11 = 3;  better and error than an unexpected answer!
ERROR: Cannot cast INT to ZMOD
CONTEXT: ZPMK(3, 11) = 3


Use the functions
Div
and
Mod
for quotients and remainders.