This arithmetic operator calculates the modulo operation of both operands. If one or both of the operands is a floating point number then the floating point version of the modulo operator is used. Before the modulo operation is performed the right operand is checked if it is not 0.
see also: arithmetic in Prolog is/2 rem/2
| Examples | |
| X is 16 mod 3. | succeeds, X is 1 |
| X is 16 mod 12 | succeeds, X is 4 |
| X is 16 mod 12.1. | succeeds, X is 3.9 |
| X is 2.2 mod 1.11. | succeeds, X is 1.09 |
| Exceptions | |
| The right operand is 0 | a evaluation_error(zero_divisor) exception is thrown |