Elektrine lite

โ† Feed

@SmartmanApps@dotnet.social

2023-08-28 06:27 UTC

4/6 1+4-5, which is clearly wrong, because we didn't preserve left associativity. To work right-to-left preserving left associativity, we would do +1-4+5, and we get the correct answer, because we correctly kept the minus sign with the 4 A mistake I have seen people make with 5-4+1 is to first calculate 4+1, then subtract that from 5! That's the same as doing 5-(4+1), which is NOT the same as 5-4+1 - you changed a sign and changed the answer! Hmmm, adding brackets and changing the answer ๐Ÿ˜‰ ๐Ÿ˜‚

Replies (1)

  • @SmartmanApps@dotnet.social 2023-08-28 06:28

    5/6 If you did want to do 4 and 1 first, then you would have to do it as 1-4, and THEN you would still get the correct answer. It's important to keep the minus sign with the 4. i.e. left associativity. So the easy way to do that is to work left-to-right, but within order of operations rules!

    Open ##5026416