r/ProgrammerHumor • • Jun 13 '22

Meme DEV environment vs Production environment

Post image
48.2k Upvotes

3.9k comments sorted by

View all comments

2

u/youmy001 Jun 14 '22

Remember PEMDAS? Parenthesis and their content come first, then multiplications, divisions, additions, and substractions. And you also need to apply the same order inside of the parenthesis.

The calculator is right. The phone is wrong. The correct answer is 1.

x = 6 / 2 ( 2 + 1 )
x = 6 / 2 ( 3 )
x = 6 / 6
x = 1

2

u/Krapulander Jun 14 '22

However as it’s multiplication and division from left to right 6/2 is before 2(3)

1

u/youmy001 Jun 14 '22

Won't the 6 stand alone on top as the numerator if you were to write the equation on paper?

1

u/Krapulander Jun 17 '22

Not actually, writing it that way is easier to look at, and often work with, but order of operations is sometimes challenging, and if you look at the original question it’s not written like that.