Mark McIntyre said:
Euh. only if you put in some brackets. I can't otherwise see how four
times twelve thirds times eight can equal two.
But then, everything *is* bigger in the States.
It seems obvious to me that *if* "*" binds more tightly than "/", then
the above expression
4 * 12 / 3 * 8
is equivalent to
(4 * 12) / (3 * 8)
which evaluates to 2.
There's nothing inherently inconsistent about a system in which "*"
binds more tightly than "/", but I've never heard of one. Certainly
we're all in agreement that they have the same precedence in C; I've
never encountered any other programming language in which they have
different precedence. In ordinary arithmetic as I learned it, they
have the same precedence, and the expression evaluates to 128. It's
not inconceivable that they have different precedence in some parts of
Europe, but if so this is the first I've heard of it.
I *probably* wouldn't write an expression like that that mixes "*" and
"/"; I'd likely add parentheses or even rearrange the expression, not
because it's ambiguous but because it's not immediately obvious.
In hand-written arithmetic, division is commonly represented as a
horizontal line rather than as an operator, so precedence is
determined by the placement of the parts of the expression:
4 * 12
------ * 8
3
or
12
4 * -- * 8
4
which avoids any ambiguity in the first place.
(BTW, I never learned "BOMDAS" or "BODMAS"; I just learned the rules.)