nocturne@slrpnk.net to Showerthoughts@lemmy.world · 2 months ago(-27)^2/3message-squaremessage-square12linkfedilinkarrow-up130arrow-down17file-text
arrow-up123arrow-down1message-square(-27)^2/3nocturne@slrpnk.net to Showerthoughts@lemmy.world · 2 months agomessage-square12linkfedilinkfile-text
minus-squareprintf("%s", name);@piefed.blahaj.zonelinkfedilinkEnglisharrow-up7·2 months agoSincere question: why do you put that negative -27 in parentheses?
minus-squaremschae@discuss.mschae23.delinkfedilinkEnglisharrow-up14·2 months ago-27^2/3 would come out to a different number, because the exponentiation has a higher precedence than the negation
minus-squareprintf("%s", name);@piefed.blahaj.zonelinkfedilinkEnglisharrow-up5·2 months agoAh, so without parentheses, it would be: x = -27^2 x / 3? That doesn’t sound very intuitive though…
minus-squaremschae@discuss.mschae23.delinkfedilinkEnglisharrow-up5·edit-22 months agoyup: (-27)^2/3 = ((-27) ^ 2) / 3 -27^2/3 = (-(27 ^ 2)) / 3 The reason is that you almost always want the negation to happen after the exponentiation, because it otherwise wouldn’t have any effect (at least when the exponent is even).
minus-squarebob_omb_battlefield@sh.itjust.workslinkfedilinkarrow-up2·2 months agoPresumably to avoid ambiguity as to whether the thing to exponentiate is 27 or -27.
minus-squarenocturne@slrpnk.netOPlinkfedilinkarrow-up2·2 months ago-272/3 is a different answer and problem than (-27)2/3. (-27)2 is (-27)(-27) while -272 is (-27)(27).
minus-squareTranquilTurbulence@lemmy.ziplinkfedilinkEnglisharrow-up3·edit-22 months agoI like to think of -27^2 as -(27^2).
minus-squarewholookshere@lemmy.blahaj.zonelinkfedilinkarrow-up3·2 months agoThat’s the common shorthand yes, but its still treated like its there. The other interpretation is just as valid though.
Sincere question: why do you put that negative -27 in parentheses?
-27^2/3would come out to a different number, because the exponentiation has a higher precedence than the negationAh, so without parentheses, it would be:
x = -27^2
x / 3?
That doesn’t sound very intuitive though…
yup:
(-27)^2/3=((-27) ^ 2) / 3-27^2/3=(-(27 ^ 2)) / 3The reason is that you almost always want the negation to happen after the exponentiation, because it otherwise wouldn’t have any effect (at least when the exponent is even).
Thanks! 😃
Presumably to avoid ambiguity as to whether the thing to exponentiate is 27 or -27.
-272/3 is a different answer and problem than (-27)2/3.
(-27)2 is (-27)(-27) while -272 is (-27)(27).
I like to think of
-27^2as-(27^2).That’s the common shorthand yes, but its still treated like its there.
The other interpretation is just as valid though.