Valid operators

This table lists the valid operators.
Operator
Description
Allowed in
Array Index
FSC
CMP
CMP
CPT
Safety
+
add
X
X
X
X
X
X
-
subtract/negate
X
X
X
X
X
X
*
multiply
X
X
X
X
X
X
/
divide
X
X
X
X
X
X
=
equal
X
X
X
<
less than
X
X
X
<=
less than or equal
X
X
X
>
greater than
X
X
X
>=
greater than or equal
X
X
X
<>
not equal
X
X
X
**
exponent (x to y)
X
X
X
X
&&
Logical AND
X
X
X
||
Logical OR
X
X
X
^^
Logical XOR
X
X
X
!
Logical NOT
X
X
X
ABS
absolute value
X
X
X
X
X
ACOS
arc cosine
X
X
X
X
X
AND
bitwise AND
X
X
X
X
X
X
ASIN
arc sine
X
X
X
X
X
ATAN
arc tangent
X
X
X
X
X
ATAN2
two-argument arctangent
X
X
X
X
X
COS
cosine
X
X
X
X
X
DEG
radians to degrees
X
X
X
X
BCD_TO
BCD to integer
X
X
X
X
X
IsINF
Is infinity
X
X
X
IsNAN
Is not a number
X
X
X
LN
natural log
X
X
X
X
LOG
log base 10
X
X
X
X
MOD
modulo-divide
X
X
X
X
X
NOT
bitwise NOT
X
X
X
X
X
X
OR
bitwise OR
X
X
X
X
X
X
RAD
degrees to radians
X
X
X
X
SIN
sine
X
X
X
X
X
SQRT
square root
X
X
X
X
X
TAN
tangent
X
X
X
X
X
TOD
integer to BCD
X
X
X
X
X
TRUNC
truncate
X
X
X
X
XOR
bitwise exclusive OR
X
X
X
X
X
X
Expressions
Expressions are implemented in the Logix Designer application to be passed in as an operand expression to an instruction, or to specify a variable index, as a subscript expression, in an array. These sections describe the differences between the two.
The maximum length for an operand expression is 4096 characters.
Operand Expressions
Operand expressions are provided as an operand to the following instructions: CPT, FAL, FSC, and CMP. Each of these instructions documents which operators are allowed in the expression and their precedence. CPT and FAL have identical operators and precedence. CMP and FSC have a slightly expanded operator list and therefore a different precedence list of operators.
Subscript Expressions
You can also use a subscript expression to compute an array subscript. Subscripts are processed differently than operands. See the Array Index column in the table above for a list of operators that function as subscript expressions.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.