Comment on I dunno

<- View Parent
SkyeStarfall@lemmy.blahaj.zone ⁨4⁩ ⁨days⁩ ago

That’s a very simplistic view of maths. It’s convention en.wikipedia.org/wiki/Order_of_operations

Just because a definition of an operator contains another operator, does not require that operator to take precedence. As you pointed out, 2+3*4 could just as well be calculated to 5*4 and thus 20. There’s no mathematical contradiction there. Nothing broke. You just get a different answer. This is all perfectly in line with how maths work.

You can think of operators as functions, in that case, you could rewrite 2+3*4 as add(2, mult(3, 4)), for typical convention. But it could just as well be mult(add(2, 3), 4), where addition takes precedence. Or, similarly, for 2*3+4, as add(mult(2, 3), 4) for typical convention, or mult(2, add(3, 4)), where addition takes precedence. And I hope you see how, in here, everything seems to work just fine, it just depends on how you rearrange things. This sort of functional breakdown of operators is much closer to mathematical reality, and our operators is just convention, to make it easier to read.

Something in between would be requiring parentheses around every operator, to enforce order. Such as (2+(3*4)) or ((2+3)*4)

source
Sort:hotnewtop