In mathematics, logic and computer science, operator order, operator valence, operator priority or operator precedence refers to a defined half-order in which the operators of an expression in infix notation are to be evaluated.
The operator rank order is not a total order, but a half order, because there does not have to be a strict order between all operators. There can also be more than one operator on the same rank. For example, in arithmetic, the rank of multiplication and division is the same but higher than the rank of addition and subtraction ("dot arithmetic before dash arithmetic").
Bracketing offers the possibility of giving priority to a part of a formula: The bracketed range, i.e., the range enclosed by a pair of brackets "( ... )", is to be computationally executed first and replaced by the corresponding partial result. The parentheses must contain the operators together with their necessary operands. Thus, if notated, the bracket expression is to be calculated first, i.e. the sum is to be
formed before is
multiplied by this sum.
Ranking can save explicit bracketing. Thus, in arithmetic is equivalent to
, because the multiplication operator has a higher rank. However, other rankings may be defined for other applications of these operator symbols.
In the case of non-commutative operators, additional conventions are required as to whether equal-ranking subexpressions are to be evaluated from left to right or right to left, in order to unambiguously determine the order of calculation.