Ask HN: Why is -2^2 = -4 instead of 4?
I'm puzzled. I'm wondering why if I type in wolfram alpha -2^2 I get -4 instead of 4. Same on google or anywhere else.
I get confused because in a book that I'm studying the author uses -2^2 to indicate 4, which looks correct to me. So who's correct? I'm sure I'm missing something obvious here.
Edit:
My girlfriend (which is not a programmer), says that perhaps the computer is giving precedence to the exponentiation, and then adding the -. So it would be -(2^2).
Edit2:
Thanks for all the answers. It's clear to me now.