Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Order of operations
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Special cases== ===Unary minus sign=== There are differing conventions concerning the [[unary operation]] {{nowrap|'β'}} (usually pronounced "minus"). In written or printed mathematics, the expression β3<sup>2</sup> is interpreted to mean {{nowrap|β(3<sup>2</sup>) {{=}} β9}}.{{r|BS}}{{r|ARGS}} In some applications and programming languages, notably [[Microsoft Excel]], [[PlanMaker]] (and other spreadsheet applications) and [[bc programming language|the programming language bc]], unary operations have a higher priority than binary operations, that is, the unary minus has higher precedence than exponentiation, so in those languages β3<sup>2</sup> will be interpreted as {{nowrap|(β3)<sup>2</sup> {{=}} 9}}.{{r|Microsoft 2005}} This does not apply to the binary minus {{nowrap|operation 'β';}} for example in Microsoft Excel while the formulas <code>=-2^2</code>, <code>=(-2)^2</code> and <code>=0+-2^2</code> return 4, the formulas <code>=0-2^2</code> and <code>=-(2^2)</code> return β4. ===Mixed division and multiplication=== There is no universal convention for interpreting an expression containing both division denoted by 'Γ·' and multiplication denoted by 'Γ'. Proposed conventions include assigning the operations equal precedence and evaluating them from left to right, or equivalently treating division as multiplication by the reciprocal and then evaluating in any order;{{r|Chrystal}} evaluating all multiplications first followed by divisions from left to right; or eschewing such expressions and instead always disambiguating them by explicit parentheses.{{r|Cajori}} Beyond primary education, the symbol 'Γ·' for division is seldom used, but is replaced by the use of [[algebraic fraction]]s,{{r|Wu}} typically written vertically with the numerator stacked above the denominator β which makes grouping explicit and unambiguous β but sometimes written inline using the [[Division slash|slash]] or solidus symbol '/'.{{r|iso}} {{anchor|IMF}} Multiplication denoted by juxtaposition (also known as [[implied multiplication]]) creates a visual unit and is often given higher precedence than most other operations. In academic literature, when inline fractions are combined with implied multiplication without explicit parentheses, the multiplication is conventionally interpreted as having higher precedence than division, so that e.g. {{nowrap|1 / 2''n''}} is interpreted to mean {{nowrap|1 / (2 Β· ''n'')}} rather than {{nowrap|(1 / 2) Β· ''n''}}.{{r|BS}}{{r|Chrystal}}{{r|Lennes}}{{r|Strogatz}} For instance, the manuscript submission instructions for the ''[[Physical Review]]'' journals directly state that multiplication has precedence over division,{{r|APS}} and this is also the convention observed in physics textbooks such as the ''[[Course of Theoretical Physics]]'' by [[Lev Landau|Landau]] and [[Evgeny Lifshitz|Lifshitz]]<ref group="lower-alpha" name="NB1"/> and mathematics textbooks such as ''[[Concrete Mathematics]]'' by [[Ronald Graham|Graham]], [[Donald Knuth|Knuth]], and [[Oren Patashnik| Patashnik]].{{r|GKP}} However, some authors recommend against expressions such as {{nowrap|''a'' / ''bc''}}, preferring the explicit use of parenthesis {{nowrap|''a'' / (''bc'')}}.{{r|Peterson}} More complicated cases are more ambiguous. For instance, the notation {{nowrap|1 / 2''Ο''(''a'' + ''b'')}} could plausibly mean either {{nowrap|1 / [2''Ο'' Β· (''a'' + ''b'')]}} or {{nowrap|[1 / (2''Ο'')] Β· (''a'' + ''b'')}}.{{r|FatemanCaspi}} Sometimes interpretation depends on context. The ''Physical Review'' submission instructions recommend against expressions of the form {{nowrap|''a'' / ''b'' / ''c''}}; more explicit expressions {{nowrap|(''a'' / ''b'') / ''c''}} or {{nowrap|''a'' / (''b'' / ''c'')}} are unambiguous.{{r|APS}} [[File:Precedence62xplus.jpg|thumb|6Γ·2(1+2) is interpreted as 6Γ·(2Γ(1+2)) by a ''[[fx-82MS]]'' (upper), and (6Γ·2)Γ(1+2) by a ''[[TI-83 Plus]]'' calculator (lower), respectively.]] This ambiguity has been the subject of [[Internet meme]]s such as "{{nowrap|8 Γ· 2(2 + 2)}}", for which there are two conflicting interpretations: 8 Γ· [2 Β· (2 + 2)] = 1 and (8 Γ· 2) Β· (2 + 2) = 16.{{r|Strogatz}}{{r|Haelle}} Mathematics education researcher Hung-Hsi Wu points out that "one never gets a computation of this type in real life", and calls such contrived examples "a kind of Gotcha! parlor game designed to trap an unsuspecting person by phrasing it in terms of a set of unreasonably convoluted rules".{{r|Wu}} ===Serial exponentiation=== <!-- Section header "Serial exponentiation" used as redirect target! --> If [[exponentiation]] is indicated by stacked symbols using superscript notation, the usual rule is to work from the top down:{{r|BS}}{{r|NIST}} : {{nowrap|''a''<sup>''b''<sup>''c''</sup></sup> {{=}} ''a''<sup>(''b''<sup>''c''</sup>)</sup>}}, which typically is not equal to (''a''<sup>''b''</sup>)<sup>''c''</sup>. This convention is useful because there is [[Exponentiation#Identities and properties|a property of exponentiation]] that (''a''<sup>''b''</sup>)<sup>''c''</sup> = ''a''<sup>''bc''</sup>, so it's unnecessary to use serial exponentiation for this. However, when exponentiation is represented by an explicit symbol such as a [[caret]] (^) or [[arrow (symbol)|arrow]] (β), there is no common standard. For example, [[Microsoft Excel]] and computation programming language [[MATLAB]] evaluate <code>''a''^''b''^''c''</code> as (''a''<sup>''b''</sup>)<sup>''c''</sup>, but [[Google Search]] and [[Wolfram Alpha]] as ''a''<sup>(''b''<sup>''c''</sup>)</sup>. Thus <code>4^3^2</code> is evaluated to 4,096 in the first case and to 262,144 in the second case.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)