# mod

## (number mod number) 🡒 number

The keyword mod returns a generalized flavor of the remainder of the integer division defined by:

$$(a \text{ mod } b) \mapsto a - k_0b \text{ where } k_0 = {\text{argmax} \atop {k \in \mathbb{Z}} } \left( k |b| \leq a \right)$$

where $|b|$ is the absolute value of $b$.

Example:

table T = with
[| as A |]
[| -1 |]
[| 0  |]
[| 1  |]
[| 2  |]

T.B = 2

show table "" a1b4 with
T.A
T.B
T.A mod T.B