this post was submitted on 03 Dec 2023
203 points (100.0% liked)

196

667 readers
35 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] GTG3000@programming.dev 23 points 11 months ago (2 children)

I'm with the right answer here. / and * have same precedence and if you wanted to treat 2(2+2) as a single unit, you should have written it like (2*(2+2)).

[–] sushibowl@feddit.nl 45 points 11 months ago (2 children)

It's pretty common even in academic literature to treat implied multiplication as having higher precedence than explicit multiplication/division. Otherwise an expression like 1 / 2n would have to be interpreted as (1 / 2) * n rather than the more natural 1 / (2 * n).

A lot of this bullshit can be avoided with better notation systems, but calculators tend to be limited in what you can write, so meh. Unless you want to mislead people for the memes, just put parentheses around things.

[–] GTG3000@programming.dev 9 points 11 months ago (1 children)

That's fair. Personally, I just have a grudge against math notation in general. Makes my programmer brain hurt when there's no consistency and a lot of implicit rules.

Then again, I also like Lisp so I'm not exactly without sin.

[–] SmartmanApps@programming.dev 1 points 7 months ago

Makes my programmer brain hurt when there’s no consistency and a lot of implicit rules.

All the order of operations rules of Maths are explicit

load more comments (1 replies)
[–] SmartmanApps@programming.dev 1 points 7 months ago

I’m with the right answer here

Apparently not.

if you wanted to treat 2(2+2) as a single unit

Yes, it is a Term subject to The Distributive Law, written just the way it is.