Comment on I dunno
SmartmanApps@programming.dev 4 days agoPE(MD)(AS) Now just remember to account for those parentheses first
Those Brackets don’t matter. I don’t know why people insist it does
Comment on I dunno
SmartmanApps@programming.dev 4 days agoPE(MD)(AS) Now just remember to account for those parentheses first
Those Brackets don’t matter. I don’t know why people insist it does
Feathercrown@lemmy.world 3 days ago
They do, it’s grouping those operations to say that they have the same precedence. Without them it implies you always do addition before subtraction, for example.
SmartmanApps@programming.dev 3 days ago
They don’t. It’s irrelevant that they have the same priority. MD and DM are both correct, and AS and SA are both correct.
And there’s absolutely nothing wrong with doing that, for example. You still always get the correct answer
Feathercrown@lemmy.world 3 days ago
Uh, no. I don’t think you’ve thought this through, or you’re just using (AS) without realizing it. Conversations around operator precedence can cause real differences in how expressions are evaluated and if you think everyone else is just being pedantic or is confused then you might not underatand it yourself.
Take for example the expression 3-2+1.
With (AS), 3-2+1 = (3-2)+1 = 1+1 = 2. This is what you would expect, since we do generally agree to evaluate addition and subtraction with the same precedence left-to-right.
With SA, the evaluation is the same, and you get the same answer. No issue there for this expression.
But with AS, 3-2+1 = 3-(2+1) = 3-3 = 0. So evaluating A with higher precedence rather than equal precedence yields a different answer.
SmartmanApps@programming.dev 2 days ago
It’s hilarious that you added in this in afterwards, hoping I wouldn’t see it so you could claim the last word 😂
There is only one order of operations, defined in many Maths textbooks.
Hence the order of operations rules, found in Maths textbooks
PEMDAS actually, and yes, it’s only a convention, not the rules themselves
That’s why it’s only a convention, and not a rule.
Nope, doesn’t cause any issues - the rules themselves are the same everywhere, and all of the different mnemonics all work
No it doesn’t
Just -b actually
Which is still subtraction, from 0, because every operation on the numberline starts from 0, we just don’t bother writing the zero (just like we don’t bother writing the + sign when the expression starts with an addition).
Subtraction is unary operator, not binary. If you’re subtracting from another number, then that number has it’s own operator that it’s associated with (and might be an unwritten +), it’s not associated with the subtraction at all.
No you can’t. You can put it in Brackets to make it joined to the minus sign though, like in (-1)²=1, as opposed to -1²=-1
The 1 can’t be positive if it follows a minus sign - it’s the rule of Left Associativity 😂
Image
No, they’re just you spouting more wrong stuff 😂
No, you can’t. Giving addition a higher priority is +(3+2)-1=+5-1=4, as per Maths textbooks…
Image
No, all of it was wrong, again 😂
SmartmanApps@programming.dev 3 days ago
as per the textbooks 🙄
No they can’t. The rules are universal
says someone about to prove that they don’t understand it… 😂
Nope! With AS 3-2+1=+(3+1)-(2)=4-2=2
Yes, I expected you to not understand what AS meant 😂
It’s only a convention, not a rule, as just proven
No it isn’t. With SA 3-2+1=-(2)+(3+1)=-2+4=2
Yep, because order doesn’t matter 🙄 AS and SA both give the same answer
Or any expression
You just violated the rules and changed the sign of the 1 from a + to a minus. 🙄 -(2+1)=-2-1, not -2+1. Welcome to how you got a wrong answer when you wrongly added brackets to it and mixed the different signs together
No it doesn’t., as already proven. 3-2+1=+(3+1)-(2)=+4-2=2, same answer 🙄