Different compilers have robbed me of all trust in order-of-operations. If there’s any possibility of ambiguity - it’s going in parentheses. If something’s fucky and I can’t tell where, well, better parenthesize my equations, just in case.
This is best practice since there is no standard order of operations across languages. It’s an easy place for bugs to sneak in, and it takes a non-insignificant amount of time to debug.
This is the way. It’s an intentionally ambiguously written problem to cause this issue depending on how and where you learned order of operations to cause a fight.
Please see this section of Wikipedia on the order of operations.
The “math” itself might not be ambiguous, but how we write it down absolutely can be. This is why you don’t see actual mathematicians arguing over which one of these calculators is correct - it is not either calculator being wrong, it is a poorly constructed equation.
As for order of operations, they are “meant to be” the same everywhere, but they are taught differently. US - PEMDAS vs UK - BODMAS (notice division and multiplication swapped places). Now, they will say they are both given equal priority, but you can’t actually do all of the multiplication and division at one time. Some are taught to simply work left to right, while others are taught to do multiplication first; but we are all taught to use parentheses correctly to eliminate ambiguity.
Please see this section of Wikipedia on the order of operations
That section is about multiplication, and there isn’t any multiplication in this expression.
The “math” itself might not be ambiguous, but how we write it down absolutely can be
Not in this case it isn’t. It has been written in a way which obeys all the rules of Maths.
This is why you don’t see actual mathematicians arguing over which one of these calculators is correct
But I do! I see University lecturers - who have forgotten their high school Maths rules (which is where this topic is taught) - arguing about it.
it is not either calculator being wrong
Yes, it is. The app written by the programmer is ignoring The Distributive Law (most likely because the programmer has forgotten it and not bothered to check his Maths is correct first).
Just out of curiosity, what is the first 2 doing in “2(2+2)”…? What are you doing with it? Possibly multiplying it with something else?
there isn’t any multiplication in this expression.
Interesting.
I really hope you aren’t actually a math teacher, because I feel bad for your students being taught so poorly by someone that barely has a middle school understanding of math. And for the record, I doubt anyone is going to accept links to your blog as proof that you are correct.
Different compilers have robbed me of all trust in order-of-operations. If there’s any possibility of ambiguity - it’s going in parentheses. If something’s fucky and I can’t tell where, well, better parenthesize my equations, just in case.
This is best practice since there is no standard order of operations across languages. It’s an easy place for bugs to sneak in, and it takes a non-insignificant amount of time to debug.
Yes there is. The rules of Maths are universal.
But that’s because of programmers not checking the rules of Maths first.
This is the way. It’s an intentionally ambiguously written problem to cause this issue depending on how and where you learned order of operations to cause a fight.
#MathsIsNeverAmbiguous
The order of operations are the same everywhere. The fights arise from people who don’t remember them.
Please see this section of Wikipedia on the order of operations.
The “math” itself might not be ambiguous, but how we write it down absolutely can be. This is why you don’t see actual mathematicians arguing over which one of these calculators is correct - it is not either calculator being wrong, it is a poorly constructed equation.
As for order of operations, they are “meant to be” the same everywhere, but they are taught differently. US - PEMDAS vs UK - BODMAS (notice division and multiplication swapped places). Now, they will say they are both given equal priority, but you can’t actually do all of the multiplication and division at one time. Some are taught to simply work left to right, while others are taught to do multiplication first; but we are all taught to use parentheses correctly to eliminate ambiguity.
That section is about multiplication, and there isn’t any multiplication in this expression.
Not in this case it isn’t. It has been written in a way which obeys all the rules of Maths.
But I do! I see University lecturers - who have forgotten their high school Maths rules (which is where this topic is taught) - arguing about it.
Yes, it is. The app written by the programmer is ignoring The Distributive Law (most likely because the programmer has forgotten it and not bothered to check his Maths is correct first).
Those aren’t the rules. They are mnemonics to help you remember the rules
Yes, that’s right, because they have equal precedence and it literally doesn’t matter which way around you do them.
Yes, you can!
Yes, that’s because that’s the easy way to obey the actual rule of Left associativity.
Correct! So 2(2+2) unambiguously has to be done before the division.
Just out of curiosity, what is the first 2 doing in “2(2+2)”…? What are you doing with it? Possibly multiplying it with something else?
Interesting.
I really hope you aren’t actually a math teacher, because I feel bad for your students being taught so poorly by someone that barely has a middle school understanding of math. And for the record, I doubt anyone is going to accept links to your blog as proof that you are correct.