I recall this from Data Structures, and that there's ambiguity between handle from left and PEMDAS, which is a huge argument for Reverse Polish Notation.
For context (and an example I'm hitting in my testing), 4 - 6 - 2. By PEMDAS, they're of equal order, but it really depends on if you want (4 - 6) - 2 == -4 or 4 - (6 - 2) == 0.
With RPN, it's always number number operator, and variations on that are how we get precedence.
4 6 2 - - has 6 2 - in number number operator form and thus becomes 4, simplifying to 4 4 - and then 0.
4 6 - 2 - would get you the 4 6 - first, giving -2, then -2 2 -, which is -4`
Not that I do my regular math like this...
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I recall this from Data Structures, and that there's ambiguity between handle from left and PEMDAS, which is a huge argument for Reverse Polish Notation.
For context (and an example I'm hitting in my testing),
4 - 6 - 2. By PEMDAS, they're of equal order, but it really depends on if you want(4 - 6) - 2 == -4or4 - (6 - 2) == 0.With RPN, it's always
number number operator, and variations on that are how we get precedence.4 6 2 - -has6 2 -innumber number operatorform and thus becomes4, simplifying to4 4 -and then0.4 6 - 2 -would get you the4 6 -first, giving-2, then-2 2 -, which is -4`Not that I do my regular math like this...