Reference Manual
PMAC 2 Software Reference
360 PMAC Mathematical Features
PMAC MATHEMATICAL FEATURES
Mathematical Operators
+
Function
Addition
Remarks
The + sign implements the addition of the numerical values preceding and following it.
Multiplication, division, modulo (remainder), and bit-by-bit “and” operations have
higher priority than addition, subtraction, bit-by-bit “or”, and bit-by-bit “exclusive-or”
operations. Operations of the same priority are implemented from left to right.
The + sign may not be used as a “unary” operator to emphasize that the positive value
of the following variable or constant is to be used (e.g. P1=+P2). This syntax will be
rejected with an error.
-
Function
Subtraction
Remarks
The - sign implements the subtraction of the numerical value following it from the
numerical value preceding it. If there is no numerical value immediately preceding it,
it causes the negation of the numerical value following it (e.g. P1=-P2).
Multiplication, division, modulo (remainder), and bit-by-bit “and” operations have
higher priority than addition, subtraction, bit-by-bit “or”, and bit-by-bit “exclusive-or”
operations. Operations of the same priority are implemented from left to right.
*
Function
Multiplication
Remarks
The * sign implements the multiplication of the numerical values preceding and
following it.
Multiplication, division, modulo (remainder), and bit-by-bit “and” operations have
higher priority than addition, subtraction, bit-by-bit “or”, and bit-by-bit “exclusive-or”
operations. Operations of the same priority are implemented from left to right.
/
Function
Division
Remarks
The / sign implements the division of the numerical value preceding it by the numerical
value following it. Unless the division is executed in a compiled PLC on a line with
only L-variables and integers, the division operation is always a floating-point
calculation (even if integer values are used). The quotient is computed as a floating-
point value and used as such in subsequent calculations in the same expression; if it is
then stored to an integer, it is rounded at the time of storage.
If the division operation is performed as an integer operation in a compiled PLC (only
L-variables and integer constants on the line), the quotient is computed as an integer
(rounded to the nearest integer value) and used as such in subsequent calculations in
the same expression.
Multiplication, division, modulo (remainder), and bit-by-bit “and” operations have
higher priority than addition, subtraction, bit-by-bit “or”, and bit-by-bit “exclusive-or”
operations. Operations of the same priority are implemented from left to right.