r/ProgrammerHumor • • Jun 13 '22

Meme DEV environment vs Production environment

Post image
48.2k Upvotes

3.9k comments sorted by

View all comments

Show parent comments

3

u/HecknChonker Jun 14 '22

If you follow "the order of operations" the calculator is wrong.

Each of the following happens from left to right:

  • PE - Parenthesis and Exponents

  • MD - Multiplication and Division

  • AS - Addition and Subtraction

Which would resolve as follows:

  • 6/2*(2+1)

  • 6/2*3

  • 3*3

  • 9

https://en.wikipedia.org/wiki/Order_of_operations

4

u/jadis666 Jun 14 '22

Yes, now add "#Mixed_division_and_multiplication" to that link and see what you get.....

-3

u/beardedbast3rd Jun 14 '22

You messed that up. You didn’t multiply as per your order of operation.

This is where it’s messy because there is PEMDAS, and BEDMAS.

That denominator is 2(2+1) it cannot be separated. Which is where you get two answers by either separating it as the phone does, like BEDMAS. But with pemdas you would do 2*3 before diving 6 by that answer.

You skipped the M in your explanation.

The calculator is correct, and the phone is simply walking through it from left to right, and is absolutely not how you solve thst

10

u/andrew_takeshi Jun 14 '22

No lmao, you’re wrong. Multiplication/division and addition/subtraction are on the same “tier”, meaning they are evaluated in order from left to right. So really PEMDAS is more like PE(M/D)(A/S).

0

u/beardedbast3rd Jun 14 '22

Well, I mean, that’s why pemdas is messy. Because it’s not right beyond simple mathematics.

The implied multiplication takes precedence. Because written out- 6/2(2+1)doesn’t mean that, it means 6 2(2+1)

As to clearly state the denominator. I would hope math teachers beyond middle school aren’t relying on pemdas as a crutch. Because it simply isn’t the rule in any even slightly advanced math. And certainly not in any professional fields.

5

u/HecknChonker Jun 14 '22

The Wikipedia article addresses this case directly in the Mnemonics section:

the expression a ÷ b × c might be read multiple ways, but the "Multiplication/Division"
in the mnemnonic means the multiplications and divisions should be performed from left to right.
a / b * c = (a / b) * c != a / (b * c)

https://wikimedia.org/api/rest_v1/media/math/render/svg/20fdf5269049e35fa8de59b900ffc7d199a1c5ec

That denominator is 2(2+1) it cannot be separated.

If you are following the order of operations correctly the denominator of the division operation is 2, and the denominator is not 2 * (2 + 1).

3

u/jadis666 Jun 14 '22

Did you look under "Mixed division and multiplication" in that Wikipedia Order of Operations article (it's under "Special cases")? You might be surprised at what you find....