Emphasis added...
FactChecker said:
The rule is PEMDAS:
Parentheses. Exponents. Multiplication and Division (from left to right) Addition and Subtraction (from left to right)
I agree that this is how it
should be, but I'm not sure that it's presented this way; i.e., that arithmetic operations at the same precedence are evaluated left to right.
This PEMDAS (or BEDMAS/BODMAS/BIDMAS as are used in Canada/New Zealand and a bunch of other countries) came about after my time in grade school and high school, so I don't have any idea how it's normally presented. The wiki article here (
https://en.wikipedia.org/wiki/Order_of_operations#Mnemonics) makes no mention of associativity of operations at the same precedence, but they do give some exceptions, further clouding the water.
Mixed division and multiplication
Similarly, there can be ambiguity in the use of the slash symbol / in expressions such as 1/2x
The article interprets this as (1/2)x.
Later in the same section, is this:
However, in some of the academic literature, multiplication denoted by juxtaposition (also known as implied multiplication) is interpreted as having higher precedence than division, so that 1 ÷ 2x equals 1 ÷ (2x), not (1 ÷ 2)x.
Certainly ##\frac 1 {2x}## should be interpreted as division by 2x, and I can make a case for 1 ÷ 2x, but the symbol ÷ isn't on computer keyboards, so the symbol / gets recruited for this purpose, and we're back to ambiguity again.
It's just as bad with calculators.
An expression like 1/2x is interpreted as 1/(2x) by TI-82, but as (1/2)x by TI-83 and every other TI calculator released since 1996
The Windows calculator evaluates ##1 + 2 \times 3## in two different ways, depending on whether you're using it in Standard mode vs. Scientific mode. For the record, Standard mode evaluates this expression as 9, and Scientific mode evaluates it as 7.
My whole point is that the programming world has its act together as regards expression evaluation, but the math community, not so much.