The commonly used notation of arithmetic operations and formal logic expressions is called infix notation, because it disables the operators between the operands. For example:
1 2 · 8/12 However, this representation lead to confusion, as the result of the sequence of execution of the arithmetic operations may depend. In above-mentioned example, for example, the following processings are possible:
- Left to right
1 2 = 3 3 x 8 = 24 24/12 = 2 Point before line statement ( commonly used form)
2 × 8 = 16 16/12 = 1.333 ... 1 1.333 ... = 2.333 ... But since there are still ambiguities, for example, at 1/ 2 × 3:
- From left to right as 1 / ( 2.3):
2 x 3 = 6 1/6 = 0.1666 ... from left to right as (1 /2) · 3 ( commonly used form)
1/2 = 0.5 0.5 x 3 = 1.5 It has therefore been agreed by the infix notation to specific rules for processing complex arithmetic operations. This set priorities for individual operators groups. So ( addition, subtraction ) is performed, for example, point calculation (multiplication and division) before addition and subtraction. If more than one point calculations or more bar bills each other, then they are evaluated from left to right; one says that the affected operators are left- associative.
Even before the point calculations exponentiations are evaluated, so that eg is. The potentiation is also right-associative, ie is evaluated from right to left as opposed to dot and line bills. This means that, for example, the expression must be read as.
To change the thus predefined operator precedence, one uses different types of characters outline how the brackets here have already been used. More about the outline characters, see Operator Precedence: Outline characters.