Re:Partial Operator Precedence
by sheept on Thursday November 05, 2026 @03:23AM
(#50376597)
JavaScript does something similar for the exponentiation operator. This is a syntax error:
Someone who learned PEMDAS in school may argue it should be equivalent to -(a * b), while a programmer may be used to unary operators binding tightest, so (-a) * b.
[ Parent
| on HN ]
Re:Partial Operator Precedence
by marcosdumay on Thursday November 05, 2026 @11:05AM
(#50380865)
The unary minus isn't in PEMDAS. Besides, I have never seen anybody that interprets -2^2 as -4 instead of 4.