News for hackers. Stuff that matters.
Re:6÷2(1+2)=? by armadillowarran 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?

Re:6÷2(1+2)=? by gizmo686 on Sunday March 17, 2013 @07:33PM (#5391589)
When you have 6/2(3), it is not well define if the correct expansion is 6/(23) or (6/2)3. In my experience with math, the intuitive answer is that implicit multiplication takes precedence. For example, say instead of 6/2(3), you had 6/2x. Following your convention, that would expand to (6/2)x, not 6/(2x). You might say that the () around the last number make a difference. However that would imply that 6/2x!=6/2(x). Which I find deeply unsettling if true.

Ultimitly, this is why we tend to use notation which uses placement to resolve these issues unambiguasly, without alot of parentheses.

Re:6÷2(1+2)=? by armadillowarran 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!