• @[email protected]
    link
    fedilink
    491 year ago
    • 16 is the right answer if you use PEMDAS only: (8 ÷ 2) × (2 + 2)
    • 1 is the right answer if you use implicit/explicit with PEMDAS: 8 ÷ (2 × (2 + 2))
    • both are correct answers (as in if you don’t put in extra parentheses to reduce ambiguity, you should expect expect either answer)
    • this is also one of the reasons why postfix and prefix notations have an advantage over infix notation
      • postfix (HP, RPN, Forth): 2 2 + 8 2 ÷ × .
      • prefix (Lisp): (× (÷ 8 2) (+ 2 2))
    • @[email protected]
      link
      fedilink
      31 year ago

      prefix notation doesn’t need parentheses either though, at least in this case. lisp uses them for readability and to get multiple arity operators. infix doesn’t have any ambiguity either if you parenthesize all operations like that.

    • 16 is the right answer if you use PEMDAS only: (8 ÷ 2) × (2 + 2)

      You added brackets and changed the answer. 2(2+2) is a single term, and if you break it up then you change the answer (because now the (2+2) is in the numerator instead of in the denominator).

      1 is the right answer

      The only right answer

      both are correct answers

      Nope, 1 is the only correct answer.

      this is also one of the reasons why postfix and prefix notations have an advantage over infix notation

      Except they don’t. This isn’t a notation problem, it’s a people don’t remember the rules of Maths problem.

      • synae[he/him]
        link
        fedilink
        English
        2
        edit-2
        1 year ago

        PEMDAS is actually (PE)(MD)(AS). Those that are grouped together have equal precedence and are evaluated left to right.

        8 / 2 * (2+2)

        8 / 2 * 4

        4 * 4

        16

        Edit to fix formatting, maybe?