Operator Precedence in Circuit Expressions

Expressions are evaluated using the following order of operator precedence.

  1. Parentheses may be used to group operations. Operations in the innermost pair of parentheses are evaluated first. The result of the operations within a set of parentheses becomes an operand for the next level of evaluation.
  2. The arguments to functions can be expressions. An expression that is used as the argument to a function is evaluated before the function is called.
  3. Functions have higher precedence than operators outside of functions. When functions are nested, the innermost function is evaluated first.
  4. Unary minus (-) and unary NOT (!) operators are applied to their operands before binary operators are applied. If parentheses are not used, a unary operator applies only to the very next operand.
  1. Power (**) is the highest binary operator. When two exponentiation operations are present without parentheses to control the precedence, evaluation is left to right.
  1. Multiply (*) and divide (/) have equal precedence. When two multiplies or divides are present without parentheses to control the precedence, evaluation is left to right.
  1. Add (+) and subtract (-) have equal precedence. When two additions or subtractions are present without parentheses to control the precedence, evaluation is left to right.
  1. Relational operators (>, <, =, ==, <>, >=, <=) have equal precedence. When two relational operators are present without parentheses to control the precedence, evaluation is left to right.