3

To sum up my question would be is a calculator not following the standard left to right order of operations considered a bad calculator? Is this being a universal convention means that programs or calculators that do not follow it are wrong?

My college uses a self-made program for us to do our homework assignments. I'm having an argument with one of its technical support guys as to whether the program is wrong for not following this convention, since my answer was marked wrong for giving an answer in this format: A / B * C, instead of one with parentheses ( i.e. (A / B) * C ). He claims that the answer is ambiguous and could also be interpreted as A / (B * C). In my opinion since most calculators, programming languages, and the likes do follow a convention then it should too.

idanp
  • 181
  • 1
    See Order of operations: Calculators. "When the user is unsure how a calculator will interpret an expression, it is a good idea to use parentheses so there is no ambiguity." – Mauro ALLEGRANZA Nov 09 '17 at 17:02
  • 2
    "In my opinion since most calculators, programming languages, and the likes do follow a convention then it should too. " In my opinion you are wrong. Calculators do not do math. They calculate. So if they follow a convention that isn't one humans follow then the humans should recognize that and take it into account when they use one. Humans first. Programs second. – fleablood Nov 09 '17 at 17:08
  • Would you prefer a calculator that gives and error every time you type in $A \div B \times C$. Also humans can write in 2-dimensions as they do when they write $\frac abc$. Requiring left-to-right input is a limiting and unnatural (although unavoidable and practical) constraint that calculators, programmers, and typists must endure. – fleablood Nov 09 '17 at 17:12
  • 3
    Duplicate of What is $48\div2(9+3)$? and its links – Bill Dubuque Jun 12 '24 at 22:16

1 Answers1

4

In mathematics, $a/b c$ is clearly ambiguous and the ambiguity needs to be removed by writing $\frac{a}{b} c$ or $\frac{a}{bc}$ or $(a/b)c$ etc. In programming languages it is true that most languages such as python, c++, fortran etc give the same precedence to * and /, and a "left associativity" rule, but computer languages have a much wider range of applications than just arithmetic expressions between numbers, so I don't think it can be considered a general rule. Do you know that old pocket Hewlett Packard calculators used reverse polish evaluation, and the same expression was written A B / C *?

My conclusion is that it is always better to remove the ambiguities by yourself.

Gribouillis
  • 16,826
  • "a/bc is clearly ambiguous" - no, it isn't. bc=(bxc) by definition. See Cajori (1928) or literally any Maths textbook. – donaldp Jun 12 '24 at 11:27
  • 2
    Nope , this expression IS ambigious. – Peter Jun 12 '24 at 14:51
  • 1
    @Peter No, it isn't. See Cajori (1928) or literally any Maths textbook. I included a screenshot of Cajori at https://math.stackexchange.com/questions/639290/how-to-correctly-do-a-division-using-a-slash/4929335#4929335 – donaldp Jun 12 '24 at 20:00
  • 2
    @donaldp Let me remark that the historical analysis of Mr Cajori is already one century old, therefore it does not consider the ocean of mathematical literature that has been published since that time. I have read a fair amount of maths textbooks and I never met someone who left such an ambiguity in the text. The fact that $bc = b\times c$ does not make it less ambiguous, $a/b\times c$ would not be better. The best solution is the one that all readers will understand without hesitation. Also in a world where software like TeX are available, issues of the early 20th century can be avoided. – Gribouillis Jun 12 '24 at 20:16
  • 2
    @Gribouillis "does not consider the ocean of mathematical literature that has been published since that time" which all obeys the rule as described by Cajori. "The fact that bc=b×c does not make it less ambiguous" - it DOESN'T equal bxc. It equals (bxc), note the brackets, as per Cajori screenshot. bc is a single term, hence no ambiguity. – donaldp Jun 12 '24 at 20:35