Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

66%
+2 −0
Q&A What're the orders for equation expressing?

posted 2y ago by r~~‭  ·  edited 2y ago by r~~‭

Answer
#2: Post edited by user avatar r~~‭ · 2021-09-03T04:28:09Z (over 2 years ago)
  • 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 by user avatar r~~‭ · 2021-09-03T04:09:51Z (over 2 years ago)
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.