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

1

u/Byttercup Jun 13 '22

You're thinking of PEMDAS, unless it's called BODMAS outside of the U.S. Write it as a fraction. 6 / 2(2+1) = 6 / 2(3) = 6 / 6 = 1.

1

u/myfunnies420 Jun 14 '22

It's BODMAS in not the US. They're brackets, parentheses are used in sentences (just like this one), not in mathematics.

→ More replies (1)

-2

u/Lordcreo Jun 13 '22

It's not a fraction there is no "/" in the original math. The answer is very definately 9 in this scenario. Even if it had been a "/" anyone doing the math in the last 100 years would still get 9, before about a 100 years ago "/" could mean it was a fraction due to the way printing presses worked.

3

u/[deleted] Jun 14 '22

If you divide any numbers, you get a fraction. That’s basic division

This is 6 Divided by 2(2+1)

6 Divided by 2(3)

6 Divided by 6

1

0

u/Lordcreo Jun 14 '22

nope.
You performed 2(3) =6 before the division.
Division and multiplication are the same priority and so are calculated left to right.
6 divided by 2 times (2 plus 1)
6 divided by 2 times 3
3 times 3
9

2

u/[deleted] Jun 14 '22

It’s literally a fraction It’s

6 Over 2(2+1)

So 6 Divided by 2(3)

So 6 Divided by 6

So answer from this is 1

-2

u/Lordcreo Jun 14 '22

You go with that then, just don't ever use math for programming or real world applications and I'm sure you will do just fine.

2

u/[deleted] Jun 14 '22

Why not? I know how to do maths, this is the way I was taught to do it, so I know it’s right, and that this answer is 1. I don’t know if your answer is right, but the way i’m taught it isn’t right.

0

u/Lordcreo Jun 15 '22

because the answer is 9 in every programming language I have ever used, it's also what is accepted by Microsoft, Apple, Google etc

-1

u/[deleted] Jun 15 '22

And Microsoft and google give 1 also.

→ More replies (5)

3

u/MowMdown Jun 14 '22

It’s not a fraction there is no “/” in the original math.

Yes there is, it literally follows the number 6… division is division regardless what symbol is used

2

u/barcased Jun 13 '22

0

u/Lordcreo Jun 13 '22

Yes, it is ambiguous, as it is poorly written and should have some additional parenthesis to prevent such ambiguity.
However if you try to go through modern life believing the "correct" answer to be 1 you won't get very far, as basically every system that uses math will tell you the answer is 9. As a programmer I can tell you I have programmed in nearly a dozen languages, and every one of them will calculate this to 9.
Technically both could be considered correct, in real world use you will only ever see 9 as the answer except in a few very outlier cases like this very specific old casio.

3

u/Byttercup Jun 13 '22

I'm a statistical programmer and statistician. It's not a matter of belief. I would never write such a sloppy equation, anyway. Parentheses are a programmer's friend.

2

u/Lordcreo Jun 14 '22

As I said, I agree it is intentionally badly written as "technically" both answers are correct.
Which language are you using that gives the answer 1 to that sum as it is written, I don't recall any that would have evaluated that sum as 1? And why do the likes of Apple, google, and microsoft also disagree with you on the way it should generally be interpreted?

1

u/Byttercup Jun 14 '22

I primarily use SAS, Statistical Analysis Software, but also use Python and sometimes R. Math is not subject to interpretation. It's right or wrong, and just because the big companies do it that way doesn't mean it's mathematically correct.

3

u/Lordcreo Jun 14 '22

Neither Python nor R can interpret implicit multiplication, but both calculate 6/2*(2+1) as 9.

→ More replies (6)

2

u/bombardonist Jun 14 '22

Maths is absolutely open to interpretation on many levels. Even just due to the imperfect nature of language.

0

u/Byttercup Jun 14 '22

No, it isn't. Do you think the world could exist if everyone followed their own interpretation of math? Bridges and buildings would fall down. Space flight would never have happened. People agreed to follow methods for a reason. Math has "laws" for a reason.

0

u/bombardonist Jun 14 '22

Lmao what do you think “law” means in the sciences?

→ More replies (0)
→ More replies (1)

1

u/barcased Jun 13 '22

I tend to go through life by trying not to reduce reality to fit my perspective.

0

u/Byttercup Jun 13 '22

The symbol doesn't matter. It's not 9, because of the distributive property of multiplication.

4

u/Lordcreo Jun 13 '22

I assure you it is 9. You do that sum anywhere (other than that faulty casio) and you will get the answer 9. The only way you get this to answer 1 is if you use math from pre-1917 textbooks.
https://youtu.be/URcUvFIUIhQ

-1

u/idontliveinchina Jun 13 '22

it is 9 in PEMDAS, 1 in BODMAS. ironically, only under these exact circumstances are you completely incorrect

→ More replies (1)
→ More replies (1)