SmartmanApps ,
@SmartmanApps@programming.dev avatar

Please see this section of Wikipedia on the order of operations

That section is about multiplication, and there isn't any multiplication in this expression.

The “math” itself might not be ambiguous, but how we write it down absolutely can be

Not in this case it isn't. It has been written in a way which obeys all the rules of Maths.

This is why you don’t see actual mathematicians arguing over which one of these calculators is correct

But I do! I see University lecturers - who have forgotten their high school Maths rules (which is where this topic is taught) - arguing about it.

it is not either calculator being wrong

Yes, it is. The app written by the programmer is ignoring The Distributive Law (most likely because the programmer has forgotten it and not bothered to check his Maths is correct first).

US - PEMDAS vs UK - BODMAS

Those aren't the rules. They are mnemonics to help you remember the rules

notice division and multiplication swapped places

Yes, that's right, because they have equal precedence and it literally doesn't matter which way around you do them.

you can’t actually do all of the multiplication and division at one time

Yes, you can!

Some are taught to simply work left to right

Yes, that's because that's the easy way to obey the actual rule of Left associativity.

we are all taught to use parentheses correctly to eliminate ambiguity

Correct! So 2(2+2) unambiguously has to be done before the division.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • kbinchat
  • All magazines