174 • SMP Gateway User Manual
17.1.4.7 Arithmetic Operators
You can use the following arithmetic operators in expressions:
Operator Description
+ [Add] Calculates the sum of the left and right operands.
- [Subtract] Calculates the difference between the left and right operands.
* [Multiply] Calculates the product of the left and right operands.
/ [Divide] Divides the left operand by the right operand.
( [Opening parenthesis] Expressions are evaluated according to standard operator precedence.
Parentheses are used to group sub-expressions and control the order in
which expressions are evaluated.
1 + 2 * 3 evaluates to 7
(1 + 2) * 3 evaluates to 9
) [Closing parenthesis] Expressions are evaluated according to standard operator precedence.
Parentheses are used to group sub-expressions and control the order in
which expressions are evaluated.
1 + 2 * 3 evaluates to 7
(1 + 2) * 3 evaluates to 9
17.1.4.8 Binary Operators
Binary operators are used to manipulate the individual bits of expressions or data points.
You can use the following binary operators in expressions:
Operator Description
BAND Calculates a bitwise AND between the left and right operands.
For instance, 12 BAND 5 evaluates to 4 (1100 BAND 0101 is 0100).
BOR Calculates a bitwise OR between the left and right operands.
For instance, 12 BOR 5 evaluates to 13 (1100 BAND 0101 is 1101).
BNOT Calculates a bitwise NOT of the value to the right.
For instance, BNOT 0 evaluates to -1 (BNOT …0000 is …1111).
BXOR Calculates a bitwise XOR between the left and right operands.
For instance, 12 BXOR 5 evaluates to 9 (1100 BXOR 0101 is 1001).
BEQV Calculates a bitwise EQV between the left and right operands.
For instance, 12 BEQV 9 evaluates to 6 (1100 BEQV 0101 is 0110).