[Contents] ·
[Home] ·
[Mail]

## SALIERI Language - Operator "mod" (_MOD)

** Type:**

_MOD: integer x integer -> integer

** Call syntax:**

_MOD(*x*,
*y*)

*x* mod
*y*

** Description:**

The binary infix operator "mod" realises the computation
of integer division remainders;
there is a corresponding
predefined function *_MOD*, such that
*a mod b* and
*_MOD(a,b)* are equivalent expressions.

"mod" on negative arguments is defined such that the
following equalities hold:

*-x mod y = (y - x mod y) mod y*

*-x mod -y = -x mod y*

In expressions, "mod" binds stronger than "+" and "-",
but weeker than list element access (@) and
the length operator (#).

** Example:**

> 130 mod 5

*Result= 0*

> 13 mod 5

*Result= 3*

> -13 mod 5

*Result= 2*

> 13 mod -5

*Result= 3*

> -13 mod -5

*Result= 2*

** See also:**
Operator "div",
Operators and Expressions.

[Contents] ·
[Home] ·
[Mail]

*© sic!systems, page frame designed by
hh;
this page has been automatically generated from the SALIERI
Documentation Database.
*