Attention
IronPLC supports IEC 61131-3 Structured Text excluding I/O mapping.
Arithmetic Operators¶
Arithmetic operators perform mathematical computations on numeric values.
IEC 61131-3 |
Section 3.3.1 |
Support |
Supported |
Syntax¶
Operator |
Syntax |
Description |
|---|---|---|
|
|
Addition |
|
|
Subtraction |
|
|
Multiplication |
|
|
Division (integer division for integer types) |
|
|
Modulo (remainder after division) |
|
|
Exponentiation (power) |
|
|
Unary negation |
Description¶
Arithmetic operators apply to integer types (SINT, INT, DINT,
LINT, USINT, UINT, UDINT, ULINT) and floating-point types
(REAL, LREAL). For integer division, the result is truncated toward
zero. The MOD operator returns the remainder of integer division and is
defined only for integer types.
The unary negation operator - has higher precedence than the binary
arithmetic operators. Exponentiation ** has higher precedence than
multiplication, division, and modulo.
Example¶
See Also¶
Comparison Operators — relational operators
Logical Operators — boolean operators
Assignment — storing expression results