• GTG3000@programming.dev
    link
    fedilink
    arrow-up
    49
    ·
    7 months ago

    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
      link
      fedilink
      arrow-up
      72
      ·
      7 months ago

      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.