4.7.2 Infix Operators

Infix operators take two arguments, one on either side. Operators have a precedence, by type, as shown in the table below; but, operations with equal precedence are performed left to right. Apart from + or –, both operators must be absolute, and the result is absolute.

Table 4-7. Infix Operators
Operator Description Example
Arithmetic
* Multiplication 5 * 4 (=20)
/ Division. Truncation is the same as the C operator ‘/’. 23 / 4 (=5)
% Remainder 30 % 4 (=2)
<< Shift Left. Same as the C operator ‘<<’ 2 << 1 (=4)
>> Shift Right. Same as the C operator ‘>>’ 2 >> 1 (=1)
Bit-Wise
& Bit-wise And 4 & 6 (=4)
^ Bit-wise Exclusive Or 4 ^ 6 (=2)
! Bit-wise Or Not 0x1010 ! 0x5050 (=0xBFBF)
| Bit-wise Inclusive Or 2 | 4 (=6)
Simple Arithmetic
+ Addition. If either argument is absolute, the result has the section of the other argument. You may not add together arguments from different sections. 4 + 10 (=14)
- Subtraction. If the right argument is absolute, the result has the section of the left argument. If both arguments are in the same section, the result is absolute. You may not subtract arguments from different sections. 14 - 4 (=10)
Relational
== Equal to .if (x == y)
!= Not equal to (also <>) .if (x != y)
< Less than .if (x < 5)
<= Less than or equal to .if (y <= 0)
> Greater than .if (x > a)
>= Greater than or equal to .if (x >= b)
Logical
&& Logical AND .if ((x > 1) && (x < 10))
|| Logical OR .if ((y != x) || (y < 100))