this post was submitted on 03 Dec 2023
420 points (99.8% liked)

196

16597 readers
1783 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
[–] [email protected] 98 points 1 year ago (78 children)

There's quite a few calculators that get this wrong. In college, I found out that Casio calculators do things the right way, are affordable, and readily available. I stuck with it through the rest of my classes.

[–] [email protected] 17 points 1 year ago (66 children)

My Casio calculators get this wrong, even the newer ones. BTW the correct answer is 16, right?

[–] [email protected] 51 points 1 year ago (6 children)
  • 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))
[–] brian 2 points 1 year ago (1 children)

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.

[–] SmartmanApps 0 points 8 months ago

infix doesn’t have any ambiguity either if you parenthesize all operations like that

There isn't any ambiguity even if you don't.

load more comments (4 replies)
load more comments (63 replies)
load more comments (74 replies)