up
previous
next
4.2.4 Modular Integers
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.
example
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;
FALSE
-------------------------------
Use the functions
Div
and
Mod
for quotients and remainders.