News for hackers. Stuff that matters.

armadillowarran

Re:6÷2(1+2)=? on Sunday March 17, 2013 @07:42PM (#5391611)
I find it interesting you feel this way.

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 right

Your 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!

Re:6÷2(1+2)=? on Sunday March 17, 2013 @07:23PM (#5391545)

  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?