1 + 5 * 2
Depending who you talk to, it could either be 12 (6 * 2) or the appropriate and correct answer 11 (1 + 10).Everybody knows the precedence of things, but to make matters clear, here's the list ordered in descending precedence:
- parenthesis (also known as brackets)
- exponents/roots
- multiplication/division
- addition/subtraction
Mnemonics
Several mnemonics are in use to remember the correct precedence. Below are three examples.“Please Excuse My Dear Aunt Sally”
- Parentheses
- Exponents
- Multiplication
- Division
- Addition
- Subtraction
However, this mnemonic doesn't do justice to the fact that some operations actually have the same precedence, for example subtraction and addition.
“Hallo, Meneer van Dalen wacht op antwoord!”
- Haakjes (Parentheses)
- Machtsverheffen (Exponents)
- Vermenigvuldigen (Multiplication)
- Delen (Division)
- Worteltrekken (Root)
- Optellen (Addition)
- Aftrekken (Subtraction)
This Dutch mnemonic is very very old (and very wrong nowadays). It indicates that roots are very low in priority. Also, if taken literally, it means there's a difference in precedence between, for example, addition and subtraction, similar to the English mnemonic.
“Hé, Mw. v/d Aorta!”
A different Dutch mnemonic (written above), also contains information regarding the equality of certain operations.
- Haakjes (Parentheses)
- Machtsverheffen (Exponents)/Worteltrekken (Root)
- Vermenigvuldigen (Multiplication)/Delen (Division)
- Aftrekken (Subtraction)/Optellen (Addition)
- Mw.
- mevrouw (misses)
- v/d
- van de (of)
References
- Wikipedia - Order of operations
- http://en.wikipedia.org/wiki/Order_of_operations
- Wikipedia - Bewerkingsvolgorde
- http://nl.wikipedia.org/wiki/Bewerkingsvolgorde
No comments:
Post a Comment