1

Reading this twitter and applying Pemdas I believe that the answer should be 9, but applying this formula in emacs-calc yields 1:

'6/2(1+2)  ==>
alg' 6 / 2 * (2 + 1)
 1

Hard to believe I'm wrong, but even harder to believe emacs-calc is wrong.

4

(calc) Basic Arithmetic:

When combining multiplication and division in an algebraic formula, it is good style to use parentheses to distinguish between possible interpretations; the expression a/b*c should be written (a/b)*c or a/(b*c), as appropriate. Without the parentheses, Calc will interpret a/b*c as a/(b*c), since in algebraic entry Calc gives division a lower precedence than multiplication. (This is not standard across all computer languages, and Calc may change the precedence depending on the language mode being used. See (calc) Language Modes.) This default ordering can be changed by setting the customizable variable calc-multiplication-has-precedence to nil (see (calc) Customizing Calc); this will give multiplication and division equal precedences. Note that Calc’s default choice of precedence allows a b / c d to be used as a shortcut for

     a b
     ---.
     c d 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.