little_dragon wrote:So Excel and stuff doesn't do the order of operations? That's confusing!

It does all the other operations in the correct order, but it swaps the order of the unary minus sign (i.e. the minus in '-5') and exponent (i.e. the 2 in x^2).

So, pure maths has the order:

parentheses,

exponent,

unary minus sign | multiplication | division,

addition | subtraction (i.e. binary minus)

and Excel has the order:

parentheses,

unary minus sign,

exponent,

multiplication | division,

addition | subtraction (i.e. binary minus).

It's important to distinguish between unary minus and binary minus, though. A

unary minus operates on just

one thing (operand), e.g -5, while a

binary minus operates on

two operands, e.g. 7 - 5.

So, in pure maths:

-5^2 = -(5^2) = -(25) = -25, because the exponent '^2' is performed before the minus sign '-'

but in Excel:

-5^2 = (-5)^2 = 25, because the minus sign '-' is peformed before the exponent '^2'

And you can also have both a binary minus and a unary minus together, as in:

6 - -2 = (6) - (-2) = 6 + 2 = 8

where the first minus is binary (as it has the two operands '6' and '-2') and the second one is unary (as it has just the one operand '2').

DAiv