Why does unary minus operator sometimes take precedence over exponentiation, and sometimes not?

Not everyone was taught what you say. I was not, for example. I was never taught how to write expressions with exponents in-line, so I never found out what the canonic meaning of x^a+b actually is.

What I was taught is that whenever there is some confusion and there may exist two ways of interpreting an expression, I should use parentheses. And that is exactly what you need to start doing.

The thing is that by now, the notation has become so widely used with no central rule telling us what the only proper way of evaluation is, that it no longer makes much sense to try to impose a world-wide standard.


Taking this into consideration, the answers are:

  1. There is no general correct rule for this kind of operation. Brackets are the way to go. There is no international standart.
  2. The following expressions should be evaluated as "input unclear". If you get an expression like that to evaluate, ask the author of the expression to further explain what they meant.

2^-2 can only be interpreted one way, because the minus sign is next to the second argument, and the exponentiation sign isn't. It's not a matter of operator precedence.

It's only when a parameter has an operator on each side that we have to use precedence to decide. For a concrete example, FORTRAN has an exponential operator built into the language, and exponentiation has the highest precedence. Unary minus has the same precedence as binary plus and minus (with left-to-right evaluation to break ties, as e.g. -4 + 3 = (-4) + 3, not -(4+3).