Introducing the new 1500MX CNC Mill. Learn more

Loading...

BINARY OPERATORS REFERENCE

Binary operators only appear inside expressions. There are three types of binary operators: mathematical, logical, and relational.

There are four basic mathematical operations: addition (+), subtraction (-), multiplication (*), and division (/). In addition, the modulus operation (MOD) finds the remainder after division of one number by another number. The power operation (**) of raising the number on the left of the operation to the power on the right. There are three logical operations: non-exclusive or (OR), exclusive or (XOR), and logical and (AND).

The relational operators are equality (EQ), inequality (NE), strictly greater than (GT), greater than or equal to (GE), strictly less than (LT), and less than or equal to (LE).

Binary operators are divided into several groups according to their precedence as follows, from highest to lowest:

  1. **
  2. * / MOD
  3. + –
  4. EQ NE GT GE LT LE
  5. AND OR XOR

If operations in different precedence groups are strung together, operations with a higher precedence are performed before operations with a lower precedence. If an expression contains more than one operation with the same precedence, the operation on the left is performed first.

EXAMPLE

[2.0 / 3 * 1.5 – 5.5 / 11.0] is equivalent to [[[2.0 / 3] * 1.5] – [5.5 / 11.0]]

which is equivalent to [1.0 – 0.5]

which is

0.5

The logical operations and modulus are to be performed on any real numbers, not just on integers. The number zero is equivalent to logical false, and any non-zero number is equivalent to logical true.