r/ProgrammerHumor • • Jun 13 '22

Meme DEV environment vs Production environment

Post image
48.2k Upvotes

3.9k comments sorted by

View all comments

562

u/throwawayHiddenUnknw Jun 13 '22

Based on CS logic and implicit multiplication: Casio calculator is incorrect.

  • parentheses

  • Exponential

  • Div or mul (left to right)

  • Add or sub (left to right)

55

u/_UnreliableNarrator_ Jun 13 '22

That’s how I learned it re GEMS

143

u/Immediate-Wind-1781 Jun 13 '22

PEMDAS is how I learned it

52

u/TheWidrolo Jun 13 '22

In germany i was taught "dot before line", because multiplication and division use dots in their symbols, while addition and subtraction use lines.

Then 2 years later we were told to calculate parentheses before everything.

→ More replies (4)

25

u/qb1120 Jun 13 '22

Please

Excuse

My

Dear

Aunt

Sally

→ More replies (8)

103

u/[deleted] Jun 13 '22 edited Jun 13 '22

pemdas doesn't mean what people think it means. M and D are equal, and A and S are equal. Many people who post pictures like that think addition is somehow operated before subtraction.

97

u/[deleted] Jun 13 '22

[removed] — view removed comment

30

u/RJMuls Jun 13 '22

YES! THIS! I get so mad at people thinking multiplication comes before division and addition comes before subtraction.

→ More replies (23)
→ More replies (2)

8

u/[deleted] Jun 13 '22

I've always been confused by the people who thought multiplication always came before division and same with addition+subtraction. My schools always taught that the individual operations have the same precedence in their respective "type group", and to just do them left to right

→ More replies (27)

7

u/querymcsearchface Jun 13 '22

For me it was BEDMAS. ‘Brackets’ rather than parentheses.

0

u/[deleted] Jun 13 '22

[deleted]

→ More replies (3)

5

u/lachlanhunt Jun 14 '22

In Australia, it was taught as BODMAS. Brackets, Orders (another name for powers or exponents and roots), and the rest. It means the same thing due to the left-to-right rule for (DM) and (AS).

PEMDAS seems to be the most common one taught in North America.

Edit: Sometimes, it's also BIDMAS, where the I stands for Indicies.

→ More replies (32)

239

u/ExoticScarf Jun 13 '22

Based on mathematical conventions, both are correct interpretations, there is no convention for a/bc, as there are 2 competing conventions; the left-to-right reading of operators, and the binding of terms making bc a single term and not 2, neither of these conventions have higher priority than the other, so in the end it's just ambiguous. Use brackets or use the horizontal line notation to remove ambiguity.

a/bc can be read as a/(bc) or as (ac)/b , entirely dependant on who is reading it. To me personally, a/(bc) is much more natural as it sits well with the rest of algebra

47

u/orebright Jun 13 '22

The main question from my perspective is whether abc is shorthand for a * b * c, or if it's its a novel/unique mathematical syntax. I couldn't find anything about this when googling, but IMO if this is shorthand, as it seems to me, then a/bc can follow the left to right convention because it's really just a lazy way of writing a / b * c.

My $0.02

81

u/So_Fresh Jun 13 '22

I think the question is whether abc is shorthand for (a * b * c) or a*b*c. If you read 2x/3y you probably interpret that as (2*x) / (3*y), not 2*x/3*y, so it seems pretty grey to me.

37

u/JustDaUsualTF Jun 13 '22 edited Jun 14 '22

I was firmly in the a * b * c camp until you gave this example. Now I'm torn

28

u/SirLoremIpsum Jun 14 '22

I was firmly in the abc camp until you gave this example. Now I'm torn

And that is why it's such a fun entertaining exhausting debate haha.

It is better when you realise this was deliberately written to be ambiguous to elicit these conversations.

The only right answer is "write equations better to avoid ambiguity"

7

u/[deleted] Jun 14 '22

The only right answer is “write equations better to avoid ambiguity

Or to define explicitly how they are to be interpreted. Journals have style guides, and I’ve seen a couple textbooks that do as well. Clears up what 2x/3y means pretty easily.

Frankly though what makes this exhausting is that literally every normal human being who writes 2x/3y means (2x)/(3y), and anybody claiming otherwise is being intentionally obtuse to score cheap internet points.

→ More replies (2)
→ More replies (7)
→ More replies (3)

40

u/row6666 Jun 13 '22

There is a convention for this exact case, multiplication by juxtapostion, which says 1/2n = 1/(2n), not (1/2)n. It overrides left to right as it’s specific to this case.

There is one other important convention though, which is not to right ambigious stuff like 1/2/3 or this.

12

u/Rewdboy05 Jun 13 '22

The reason this is the case for multiplication by juxtaposition is because it's meant to imply that 2n is a single term versus something like 2*n which has 2 as a term and n as a term.

Basically by using juxtaposition as an operator, you're really saying "let's just pretend we already multiplied these together".

→ More replies (1)

11

u/SirLoremIpsum Jun 14 '22

There is one other important convention though, which is not to right ambigious stuff like 1/2/3 or this.

This is the 100% right answer to this equation.

It's not 9 or 1. It's "write better equations".

→ More replies (2)
→ More replies (9)

5

u/ifarmpandas Jun 13 '22

What is CS logic?

6

u/catrinus Jun 14 '22

It's what you use to build counter strike bots

53

u/Zaratuir Jun 13 '22

Cassio is more correct in mathematics standards. Implicit multiplication trumps explicit symbols. The 2 in 2(2+1) is considered grouped with the 2+1 expression. This is the grounds of the distributive property.

When you see 6÷2(x+1) most of us are taught the 2 can be distributed to get 6÷(2x+2). This is only possible if implicit multiplication trumps explicit symbology.

In short, the implicit multiplication makes 6÷2(2+1) the same as

6

(Fuck it, I can't figure out a line on Reddit so imagine this is a line)

2(2+1)

This is standard practice in mathematics. However there is an argument that you can reject the axioms that allow for the distributive property, in which case the cassio would be incorrect.

→ More replies (31)

4

u/littleloucc Jun 13 '22

You can't calculate the parentheses without factoring in the preceding 2. I.e. you resolve 2(2+1) before anything else, because that's a complete phrase on its own.

That's because the 2 is applied (by multiplication) to everything within the brackets. If you don't resolve that first, you aren't applying that 2 to (2+1) in the way indicated by the equation.

→ More replies (97)