Introduction
An operator is a symbol for:
an arithmetic operation to be executed or
a logical operation to be executed or
a function edit (call)
Operators are generic, i.e. they adapt automatically to the data type of the operands.
Table of Operators
Operators are executed in sequence according to priority, see also Execution Sequence.
ST programming language operators:
Operator |
Meaning |
Order of rank |
possible operands |
Description |
---|---|---|---|---|
|
Use of Brackets: |
1 (highest) |
Expression |
Brackets are used to alter the execution sequence of the operators. Example: If the
operands
has the result -9 and
has the result 0. |
|
Function processing (call) |
2 |
Expression, Literal, Variable, Address (all data types) |
Function processing is used to execute functions (see Calling Elementary Functions). |
|
Negation |
3 |
Expression, Literal, Variable,
Address of Data Type |
During negation Example: In the example
|
|
Complement |
3 |
Expression, Literal, Variable,
Address of Data Type |
In Example: In
the example
|
|
Exponentiation |
4 |
Expression, Literal, Variable,
Address of Data Type |
In exponentiation, Example: In the example
|
|
Multiplication |
5 |
Expression, Literal, Variable,
Address of Data Type |
In multiplication, Example: In the example
Note: The |
|
Division |
5 |
Expression, Literal, Variable,
Address of Data Type |
In division, Example: In the example
Note: The |
|
Modulo |
5 |
Expression, Literal, Variable,
Address of Data Type |
For MOD the value of the first operand is divided by that of the second operand and the remainder of the division (Modulo) is displayed as the result. Example: In this example
|
|
Addition |
6 |
Expression, Literal, Variable,
Address of Data Type |
In addition, Example: In this example
|
|
Subtraction |
6 |
Expression, Literal, Variable,
Address of Data Type |
In subtraction, Example: In the example
|
|
Less than comparison |
7 |
Expression, Literal, Variable,
Address of Data Type |
The value of the first operand
is compared with the value of the second using Example: In the example
|
|
Greater than comparison |
7 |
Expression, Literal, Variable,
Address of Data Type |
The value of the first operand
is compared with the value of the second using Example: In the example
|
|
Less than or equal to comparison |
7 |
Expression, Literal, Variable,
Address of Data Type |
The value of the first operand
is compared with the value of the second operand using Example: In the example
|
|
Greater than or equal to comparison |
7 |
Expression, Literal, Variable,
Address of Data Type |
The value of the first operand
is compared with the value of the second operand using Example: In the example
|
|
Equality |
8 |
Expression, Literal, Variable,
Address of Data Type |
The value of the first operand
is compared with the value of the second operand using Example: In the example
|
|
Inequality |
8 |
Expression, Literal, Variable,
Address of Data Type |
The value of the first operand
is compared with the value of the second using Example: In the example
|
|
Logical AND |
9 |
Expression, Literal, Variable,
Address of Data Type |
With Example: In the examples
|
|
Logical AND |
9 |
Expression, Literal, Variable,
Address of Data Type |
With Example: In the examples
|
|
Logical Exclusive OR |
10 |
Expression, Literal, Variable,
Address of Data Type |
With Example: In
the example
If more than two operands are linked, the result with an uneven number of 1-states is 1, and is 0 with an even number of 1-states. Example: In the
example
|
|
Logical OR |
11 (lowest) |
Expression, Literal, Variable,
Address of Data Type |
With Example: In the example
|