Operators in ST language
The following table shows the operators used in the ST program and their priorities.
Operator
( )
Function ( )
**
NOT
*
/
MOD
+
-
<, >, <=, >=
=
<>
AND, &
XOR
OR
If a syntax includes multiple operators with a same priority, the operation is performed from the leftmost operator.
The following table shows the operators, applicable data types, and operation result data types.
Operator
*, /, +, -
<, >, <=, >=, =, <>
MOD
AND, &, XOR, OR, NOT
**
5 WRITING PROGRAMS
74
5.1 ST
Description
Parenthesized expression
Function (Parameter list)
Exponentiation
Logical negation
Multiplication
Division
Modulus operation
Addition
Subtraction
Comparison
Equality
Inequality
Logical AND
Exclusive OR
Logical OR
Applicable data type
ANY_NUM
ANY_SIMPLE
ANY_INT
ANY_BIT
ANY_REAL (Base)
ANY_NUM (Exponent)
Example
(1+2)*(3+4)
ADD_E(bo01, in01, in02, in03)
re01:= 2.0 ** 4.4
NOT bo01
3 * 4
12 / 3
13 MOD 3
in01 + in02
in01 - in02
in01 < in02
in01 = in02
in01 <> in02
bo01 & bo02
bo01 XOR bo02
bo01 OR bo02
Operation result data type
ANY_NUM
Bit
ANY_INT
ANY_BIT
ANY_REAL
Priority
1
2
3
4
5
6
7
8
9
10
11