Post History
#2: Post edited
Another aspect of operation precedence that Derek's otherwise excellent answer doesn't cover is operator associativity.- Implicit in the PEMDAS convention is the idea that the arithmetic operators are left-associative, meaning that they should be grouped from left to right when a subexpression consists of several operators in sequence that are the same (or otherwise have equal precedence): \\(2 - 5 - 3\\) is grouped as \\((2 - 5) - 3\\); \\(60 \div 5 \div 4\\) is grouped as \\((60 \div 5) \div 4\\). Sometimes, the convention for an operator is that it is right-associative. For example, the arrows in [Knuth's up-arrow notation](https://en.wikipedia.org/wiki/Knuth%27s_up-arrow_notation) for hyperoperations are usually assumed to be right-associative: \\(3 \uparrow 4 \uparrow 5\\) is assumed to mean \\(3 \uparrow (4 \uparrow 5)\\).
- Of course, if an operation has the [associative property](https://en.wikipedia.org/wiki/Associative_property), as \\(+\\) and \\(\times\\) do, that means there's no need to declare the operator as left- or right-associative. The expression will evaluate to the same result with either grouping.
- Another aspect of operation precedence which Derek's otherwise excellent answer doesn't cover is operator associativity.
- Implicit in the PEMDAS convention is the idea that the arithmetic operators are left-associative, meaning that they should be grouped from left to right when a subexpression consists of several operators in sequence that are the same (or otherwise have equal precedence): \\(2 - 5 - 3\\) is grouped as \\((2 - 5) - 3\\); \\(60 \div 5 \div 4\\) is grouped as \\((60 \div 5) \div 4\\). Sometimes, the convention for an operator is that it is right-associative. For example, the arrows in [Knuth's up-arrow notation](https://en.wikipedia.org/wiki/Knuth%27s_up-arrow_notation) for hyperoperations are usually assumed to be right-associative: \\(3 \uparrow 4 \uparrow 5\\) is assumed to mean \\(3 \uparrow (4 \uparrow 5)\\).
- Of course, if an operation has the [associative property](https://en.wikipedia.org/wiki/Associative_property), as \\(+\\) and \\(\times\\) do, that means there's no need to declare the operator as left- or right-associative. The expression will evaluate to the same result with either grouping.
#1: Initial revision
Another aspect of operation precedence that Derek's otherwise excellent answer doesn't cover is operator associativity. Implicit in the PEMDAS convention is the idea that the arithmetic operators are left-associative, meaning that they should be grouped from left to right when a subexpression consists of several operators in sequence that are the same (or otherwise have equal precedence): \\(2 - 5 - 3\\) is grouped as \\((2 - 5) - 3\\); \\(60 \div 5 \div 4\\) is grouped as \\((60 \div 5) \div 4\\). Sometimes, the convention for an operator is that it is right-associative. For example, the arrows in [Knuth's up-arrow notation](https://en.wikipedia.org/wiki/Knuth%27s_up-arrow_notation) for hyperoperations are usually assumed to be right-associative: \\(3 \uparrow 4 \uparrow 5\\) is assumed to mean \\(3 \uparrow (4 \uparrow 5)\\). Of course, if an operation has the [associative property](https://en.wikipedia.org/wiki/Associative_property), as \\(+\\) and \\(\times\\) do, that means there's no need to declare the operator as left- or right-associative. The expression will evaluate to the same result with either grouping.