# evaluation of mathematical expressions - always left to right?

Is there a rule in mathematics that states that expressions shall be evaluated from left to right assuming that all operators in the expression share the same precedence?

e.g. given the expression 6 / 2 * (1 + 2)
is there a rule so that only (6 / 2) * (1 + 2) (result: 9) is a valid representation and
6 / (2 * (1 + 2)) (result: 1) is invalid?

edit: I am asking this, because I get different results on different calculators.

-
Well, then the calculator giving wrong results is wrong. Plain wrong. – Veronica Deane Oct 11 '12 at 13:45

Yes. 6 / (2 * (1 + 2)) is wrong.

Note that even though + - * / go left to right, some operators, like ^, go right to left.

Read more here: http://en.wikipedia.org/wiki/Operator_associativity

-

No. The answer is mostly yes, for operators at the same level of presedence, such as multiplication and division, or addition and subtraction, but some operators bind more strongly than others, so that it is wrong to read $a-b\cdot c$ as $(a-b)\cdot c$. There is also the case of nested powers: $x^{y^z}$ should be read as $x^{(y^z)}$ and not as $(x^y)^z$ – which would be more easily written as $x^{yz}$ anyhow.

-

The left-to-right rule in programming allows ambiguous expressions to be evaluated. It is a palliative! A properly-written expression will not be ambiguous. The web abounds with pointless arguments about the correct answer to nonsense; one can write whatever one wishes, but that doesn't make it a precisely-constructed expression.

-