(-) precedence
|
12-22-2022, 06:05 PM
Post: #58
|
|||
|
|||
RE: (-) precedence
(12-22-2022 03:16 PM)Sukiari Wrote: Negative two is negative two, you don’t expand that to negative one times two. BTW, treating -x ≡ (-1)*x placed unary minus operator precedence below POW, but above MUL/DIV/MOD. This might clear the confusion. (unary minus is an operator, not part of number) Order of Operations: Common Misunderstandings Where do negatives fit in? Wrote:If you approach the idea starting with numerical expressions like -3^2, you are thinking of -3 as a number and assuming that the expression says to square it. If you approach it first using variables, having first discovered that "-" in a negative number is actually an operator, then it is easier to see why -x^2 should be taken as the negative of the square. So I'll start with the latter, and then it becomes natural to treat numbers the same way we treat variables. We wanted precedence order match convention, so that we can enter math expressions, WYSIWYG. Otherwise, why bother with precedence rules, and the codes to make it happen? |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)