Notation question: Is $-1^2$ equal to $1$ (because it's $(-1)^2$, as seems obvious) or $-1$ (because it's $-(1^2)$). E.g., is the $-1$ a single thing (token or whatever) in the equation? Similarly, let $x$ be $1$. Is $-x^2$ $1$ or $-1$?
I believe $-1^2$ is $1$ because "$-1$" is a single thing (a negative number), but that $-x^2$ where $x$ is $1$ is $-1$ because it's $-(x^2)$, the "$-x$" is not a single thing and exponeniation happens before negation.
Am I correct or incorrect? Or correct, but for the wrong reason?
This may seem incredibly odd to ask, but I'm suddenly unsure of something I've been sure of for more than four decades. Why would I question it? Because in JavaScript, -1 is not a numeric literal, it's a unary - operator followed by a numeric literal for the number 1, and this had pretty major ramifications for adding an exponentiation operator to the language, because the unary - has very high precedence. But I'm sure...ish that $-1$ in math notation is a literal number (and that exponentiation happens before negation).
The exponent binds first, so $-1^2 = -1\cdot 1 = -1.$