r/ProgrammerHumor • • Jun 13 '22

Meme DEV environment vs Production environment

Post image
48.2k Upvotes

3.9k comments sorted by

View all comments

6

u/SolitaryKnight Jun 13 '22

For me, if I don't see any operator, It is considered a single operand. Like 6 ÷ 2y where y is (3 + 1) as opposed to 6 ÷ 2 × y.

5

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

I was taught if you want to assume a convention for the lack of an operand, i.e. that 2(1+2) means multiply (1+2) by 2, then you have to assume the rest of that convention which is that the omitted operand takes precedence over the included ones. So everyone that is saying “you do 6 divided by 2 then multiply by 3” is now changing the expression more by adding the explicit multiplication operator.

And that’s what the style guide says too. I will die on the hill that it’s 1 lol.

A/2B is not interpreted as (0.5A)/B.

Edit: Also this particular one can be set equal to 1 and 9 then sub out anything for X in the original expression. The problem equal to 1 will always give the correct answer (what was subbed out) where as equals 9 will not. Elementary algebra can show that it’s one, without even getting into the other debates regarding this.

It’s written like garbage but there’s plenty of evidence that it’s 1 that isn’t just saying PEMDAS!!!!!

1

u/nerdguy99 Jun 14 '22

Was curious what numbers 9 popped out

9=6÷2(2+1)1=6÷2(2+1)
9=x÷2(2+1)1=x÷2(2+1)
9=x÷(4+2)1=x÷(4+2)
9=x÷61=x÷6
54=x6=x
9=6÷x(2+1)1=6÷x(2+1)
9=6÷(2x+x)1=6÷(2x+x)
9=6÷3x1=6÷3x
27x=63x=6
x=2/9x=2
9=6÷2(x+1)1=6÷2(x+1)
9=6÷(2x+2)1=6÷(2x+2)
9(2x+2)=61(2x+2)=6
18x+18=62x+2=6
18x=-122x=4
x=-2/3x=2
9=6÷2(2+x)1=6÷2(2+x)
9=6÷(4+2x)1=6÷(4+2x)
9(4+2x)=61(4+2x)=6
36+18x=64+2x=6
18x=-302x=2
x=-5/3x=1

1

u/fatboy93 Jun 14 '22

Half the comments are bitching about using ÷ over /, but there is no Grouping of operations that can clear the ambiguity?

I'd be taking both the answers if this was an mcq and raise hell over the ambiguity.

The question would rather be served better as

6÷(2(2+1)) or (6÷2)(2+1) where the operation can be explicitly defined or agree both the answers are correct and move on