0 Members and 1 Guest are viewing this topic.
The problem is the interpretation of the arithmetic expression, for PEMDAS the correct order is 6/2(1+2) = 6/2*3 = 6/6 = 1.
Exceptions[edit]There exist differing conventions concerning the unary operator − (usually read "minus"). In written or printed mathematics, the expression −3^2 is interpreted to mean 0 − (3^2) = −9,[1][5] but in some applications and programming languages, notably Microsoft Office Excel (and other spreadsheet applications) and the programming language bc, unary operators have a higher priority than binary operators, that is, the unary minus (negation or +/-) has higher precedence than exponentiation, so in those languages −32 will be interpreted as (−3)^2 = 9.[6] This does not apply to the binary minus operator −; for example while the formulas =-2^2 and =0+-2^2 return 4 in Microsoft Excel, the formula =0-2^2 returns −4. In cases where there is the possibility that the notation might be misinterpreted, a binary minus operation can be enforced by explicitly specifying a leading 0 (as in 0-2^2 instead of just -2^2), or parentheses can be used to clarify the intended meaning.Similarly, there can be ambiguity in the use of the slash ('/') symbol in expressions such as 1/2x.[7] If one rewrites this expression as 1 ÷ 2 × x and then interprets the division symbol as indicating multiplication by the reciprocal, this becomes:1 : 2 * x = 1 * (1/2) * x = (1/2)*x.With this interpretation 1/2x is equal to (1/2)x.[1][8] However, in some of the academic literature, implied multiplication is interpreted as having higher precedence than division, so that 1/2x equals 1/(2x), not (1/2)x. For example, the manuscript submission instructions for the Physical Review journals state that multiplication is of higher precedence than division with a slash,[9] and this is also the convention observed in prominent physics textbooks such as the Course of Theoretical Physics by Landau and Lifshitz and the Feynman Lectures on Physics.[nb 1] Wolfram Alpha changed in early 2013 to treat implied multiplication the same as explicit multiplication. Formerly, implied multiplication without parentheses was assumed to bind more strongly than explicit multiplication. 2x/2x, 2·x/2·x, and 2(x)/2(x) now all yield x2.[10] Newer Texas Instruments calculators (TI-83 or later) also yield x2 in all three cases.[11]
No, the interpretation is ambiguous for calculators!
Being older and wiser than I was in my last response, I maintain that RPN is the clear winner for performance, especially in an interpreted programming language, but infix is better for organization for humans.Also @martinot, please edit your post instead of double posting.