Why Your Calculator Gives a Different Answer: −3², 6÷2(1+2), and Other Order-of-Operations Traps

2026-08-24 · 7 min read · Engineeringorder of operationsPEMDASscientific calculatormath · Read in the app →

Two calculators, two answers, same keystrokes. A clear explanation of PEMDAS, implied multiplication, unary minus, and how to type expressions so every calculator agrees.

Type 6÷2(1+2) into two different calculators and you may get 9 on one and 1 on the other. Neither is "broken". They implement different — and both defensible — conventions. If you write firmware, spreadsheets, or exam answers, you need to know exactly where the ambiguity lives.

The baseline: PEMDAS / BODMAS

  1. Parentheses (Brackets)
  2. Exponents (Orders)
  3. Multiplication and Division — equal precedence, left to right
  4. Addition and Subtraction — equal precedence, left to right

The most common misreading is treating M before D. Under the standard rule, 8 ÷ 4 × 2 = 4 (left to right), not 1.

Trap 1: −3² is −9, not 9

In standard mathematical notation and in almost every programming language, exponentiation binds tighter than unary minus: −3² = −(3²) = −9. To square a negative number you must write (−3)² = 9.

Excel is the famous exception: =-3^2 returns 9 because Excel gives unary minus higher precedence. If you port a formula from Excel to Python, MATLAB, or a scientific calculator, this silently flips signs.

InputMath / Python / MATLAB / most calculatorsExcel
−3^2−99
(−3)^299
0 − 3^2−9−9

Trap 2: implied multiplication — 6÷2(1+2)

There are two conventions for a number placed next to a parenthesis:

Casio calculators historically returned 1; many TI models return 9; some Casio firmware switched to 9 after complaints, then some switched back. Wolfram Alpha gives 9. There is no authority to appeal to — the expression is badly written. Fix it with parentheses: (6÷2)(1+2) or 6÷(2(1+2)).

Trap 3: stacked exponents are right-associative

2^3^2 means 2^(3^2) = 2^9 = 512, not (2^3)^2 = 64. Python, MATLAB and standard notation agree. Some calculators and Excel evaluate left to right and return 64. Again: parentheses.

Trap 4: the fraction bar is a parenthesis

On paper, a horizontal fraction bar groups everything above and below it. When you flatten it to one line, you must add the parentheses the bar implied:

   a + b
  ───────   →   (a + b) / (c × d)     NOT   a + b / c × d
   c · d

The same applies to square roots and exponents: √(x²+y²) becomes sqrt(x^2 + y^2), and e^(−t/τ) needs exp(-t/tau), not exp(-t)/tau.

Trap 5: percent keys are not arithmetic

On many basic calculators, 200 + 10 % gives 220 (adds 10% of 200), while 200 × 10 % gives 20. Scientific calculators usually treat % as ÷100 instead. When writing a formula, write × 1.10 or × 0.10 and leave the % key alone.

How to write expressions everyone agrees on

  1. Parenthesize every negative base before an exponent: (-x)^2.
  2. Parenthesize every numerator and denominator that has more than one term.
  3. Never rely on implied multiplication next to a division sign; write * explicitly.
  4. Parenthesize stacked exponents.
  5. Replace % with a decimal factor.

Extra parentheses cost nothing. A wrong sign in a control-loop gain, or a factor of 2π in a resonance frequency, costs a lot more.

Quick self-test

Expression (standard rules)Answer
12 − 4 ÷ 2 × 36
−2² + 51
3 × 2^2^112
(8 − 2)/(1 + 2)2
10 − 3 − 25 (left to right, not 9)
Test these expressions live
The World Calculator uses a standard parser with explicit precedence — type the examples and watch the history panel.
Open the free calculator →