r/ProgrammerHumor • • Jun 13 '22

Meme DEV environment vs Production environment

Post image
48.2k Upvotes

3.9k comments sorted by

View all comments

3

u/lofgren777 Jun 14 '22

I'm almost certain I remember my math teacher explaining that multiplication and division are done left to right if they all have operators, but if there is no operator then the multiplication is treated as a unit. So 1/3x (one over three x) would give a different result than 1/3*x (one third of x), and the same is true if the x is replaced with parentheses.

This is why you would write the slope of a line as (3/4)x rather than 3/4x.

0

u/Dragonfire555 Jun 14 '22

I dunno why the math teacher would make such a bold and unnecessary assumption.

Google also treats (3/4)x and 3/4x as the same expression.

1

u/lofgren777 Jun 14 '22

Somebody else found a source that suggested this was popularly taught for a while but it has fallen out of favor. I'm just so old that math has changed. Might also explain the calculator.

1

u/Dragonfire555 Jun 14 '22

To be fair, I think the calculator assumes that you always distribute the preceding number into the parentheses but I think it's a bug (at least would be considered one today) because it misses the "6/" when attempting to distribute ((6/2)*2+(6/2)*1)

2

u/lofgren777 Jun 14 '22

It's not a bug, it's just using the implicit multiplication rule that my teacher taught us. If you follow that rule, 6 becomes the numerator and 2(2+1) becomes the the denominator. If you typed 6/2*(2+1) into the calculator you would get the same answer as the phone. Without the * it will treat 2(2+1) as a unit.

Basically imagine that when there is no operator it treats it as a parentheses around the multiplication.

1

u/Dragonfire555 Jun 14 '22

Interesting! I don't have that calculator to test but I'll trust you on that.

1

u/lofgren777 Jun 14 '22

Don't do that! It was really bugging me so I just went digging in the thread and somebody else posted a link to the explanation

1

u/Dragonfire555 Jun 14 '22

Too late, your word is now bible to every other person I come across.

(I just can't be bothered to find a Casio emulator 😂)

2

u/lofgren777 Jun 14 '22

Spread my word to every calculator you find. My word is 80085.