Mod
arithmetic-functions modulo (%)
syntax
- mod(a, b)
- a % b
definition
mod(a, b) or a % b is defined as a modulo b. The function results in the element-by-element remainder of division of the values of data-item a by the corresponding values of data item b.
applies to
Data items with Numeric value-type
conditions
- Domain unit of the arguments must match or be void (literals or parameters can be calculated with data items of any domain).
- Arguments must have matching:
example
1. attribute<float32> AmodB (ADomain) := mod(A, B);
2. attribute<float32> AmodB (ADomain) := A % B;
A | B | AmodB |
---|---|---|
0 | 1 | 0 |
1 | 1 | 0 |
4 | 2 | 0 |
7 | 3 | 1 |
-5 | -2 | -1 |
ADomain, nr of rows = 5