armadillowarran
armadillowarran on Hacker News
In my experience, it is pretty well defined:
0. Evaluate (the inside of!) parenthesis, then
1. Evaluate exponentials, then
2. Evaluate division and multiplication operators, left to right
e.g. 1 / 2 * 3 / 4 = (1/2) * 3/4 = ((1/2)*3)/4
3. Evaluate addition and subtraction operators, left to rightYour issue seems to stem from the left-to-right concept (in order in which operators are encountered as you read, left-to-right).
Your example of 6/2x to me is clearly (6/2)x. What is 1/2x ? In my experience, textbook authors/professors/math teachers tend to be disambiguous and either use the horizontal line for clarity or use parenthesis.
I attended public schools in Ontario, Canada if it makes any difference.
Edit: Oh yeah, also I have never felt that implicit operators would take precedence. Interesting!
6/2(1+2)=6/2*(1+2)=6/2*3=(6/2)*3=(3)*3=9
This is pretty well defined, I feel:- Expand implicit multiplication to explicit multiplication (e.g. 2(1+2) becomes 2*(1+2))
- Left-to-right precedence for operators of equal-precedence (divide and multiply)
The 2 is no more bound to the parenthesis than it is to the division operator.
Am I missing something?