 |
ALPHA-VISION® Functions: aci.Mod
|
aci.Mod
SUMMARY
Symetrical modulo (like in the C programming language): (-a) % b == -(a%b)
The normal modulo operator in LUA calculates a mathematical modulo.
SYNTAX
aci.Mod(
<value1>,
<value2>)
ARGUMENTS
- value1 (type:number)
-
Dividend
- value2 (type:number)
-
Divisor
RETURN VALUES
- 1 (type:number)
-
Returns the result of the modulo operation.
EXAMPLES
assert(aci.Mod(12, 3) == 0)
assert(aci.Mod(13, 3) == 1)
assert(aci.Mod(14, 3) == 2)
assert(aci.Mod(0, 3) == 0)
assert(aci.Mod(1, 3) == 1)
assert(aci.Mod(-1, 3) == -1)
assert(aci.Mod(-2, 3) == -2)
assert(aci.Mod(-3, 3) == 0)
assert(aci.Mod(-4, 3) == -1)
assert(-1 % 3 == 2)
assert(-2 % 3 == 1)
assert(-3 % 3 == 0)
assert(-4 % 3 == 2)
Syntax Notation
- [aaa]
- aaa is optional (zero or one occurences)
- (aaa|bbb)
- aaa exclusive or bbb
- (aaa)*
- aaa may occur indefinitely often or may be omitted
- (aaa)+
- aaa may occur indefinitely often but at least once
- (aaa)m..n
- aaa may occur from m to n times