Attention
IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.
MOD¶
Returns the remainder after integer division.
IEC 61131-3 |
Section 2.5.1.5.3 |
Support |
Supported |
Signatures¶
# |
Input (IN1) |
Input (IN2) |
Return Type |
Support |
|---|---|---|---|---|
1 |
|
|
|
Supported |
2 |
|
|
|
Supported |
3 |
|
|
|
Supported |
4 |
|
|
|
Supported |
5 |
|
|
|
Supported |
6 |
|
|
|
Supported |
7 |
|
|
|
Supported |
8 |
|
|
|
Supported |
Description¶
Returns the remainder of IN1 divided by IN2. MOD(a, b) is the
functional form of the MOD operator: a MOD b. Both forms are
equivalent.
The result has the same sign as IN1. The MOD function is defined
only for integer types. Division by zero causes a runtime fault.
Example¶
result := MOD(7, 3); (* result = 1 *)
result := 7 MOD 3; (* result = 1, operator form *)
result := -7 MOD 3; (* result = -1 *)