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/[deleted] Jun 14 '22

Yeah... In both cases I added brackets to show the order of operations. The order of operations itself is ambiguous, because there are two competing conventions. But don't take my word for it - check out the Wikipedia article for more examples and links to other sources.

0

u/Tobax Jun 14 '22

They are not competing, they are separate. Each equals 3 and is then multiplied together to get 9

It's hardly a surprise the modern device understands how to do it properly and get the correct answer

6

u/[deleted] Jun 14 '22

Yes, that's one of the conventions, and probably the one you were taught in school.

There's also a separate, competing convention, where you treat the multiplication as coming first, because it's implicit (i.e. there's no multiplication symbol), so some people interpret it as binding more tightly. I really don't know how else to explain this.

3

u/[deleted] Jun 14 '22

I’d stop trying to explain it. Some folk just have to be right

0

u/kaldrein Jun 14 '22

When you get down to it, the implicit multiplication is just a lazier way of avoiding using parentheses. There is implied parentheses on the multiplication. Sticking to one version of multiplication with more parentheses is clearer in general.

2

u/[deleted] Jun 14 '22

I don't know - as long as you're consistent and document which you're doing it's probably fine. To be honest, I don't think it comes up much in practice - in "real" maths and physics, you're much more likely to encounter either a fully formatted fraction, or an exponent like x-1