


In fact, the computer language LISP has no rules at all, the programmer must specify the order in which the computations should be performed.Ĭomputer languages handle arithmetic statements by converting them to data structures called trees by programs called parsers. Most languages (Fortran, C, C++, … ) carry out computations in the order 1,2,3,4 described above, although some languages like APL, Smalltalk and Occan carry out their computations from left to right. The moral is, when you are in doubt about the meaning of an expression, add parentheses!Ĭomputer languages also vary on the order in which they perform arithmetic operations. The algebraic expression 1/2 x was interpreted as 1/(2 x) by the Texas Instrument TI-82, but as (1/2) x by the TI-93 and every TI calculator since 1996. You will discover that some websites yield different answers for the same arithmetic expression.Īlgebraic operations are sometimes computed differently depending on the calculator. However, today’s textbooks tend to agree that multiplication/division as well as addition/subtraction are not carried out in any particular order but should be performed from left to right.Īn interesting exercise for the reader would be to enter various arithmetic expressions at online websites that carry out arithmetic operations. The fact that mathematical notation for the arithmetic operations +, /, ×, and – has changed over the centuries no doubt has added to the confusion. That said, many early textbooks used different rules and hence got different answers for the same expression. The origin of the rules is unknown, whether one person was responsible, or whether they were adopted gradually by the mathematics community, is unknown. They are simply a convention for consistency in arithmetic computations. There is nothing sacrosanct about these rules. Finally do additions and subtractions from left to right.Next do multiplications and divisions from left to right.First do all operations inside parentheses.In fact, the most commonly accepted rules for ordering arithmetic operations that contain division/multiplication and addition/subtraction is that there is no order of preference but to carry out computations from left to right as described by the following rules. Whereas the majority of people (you too?) assume the 3 is in the numerator following the quotient 6/2 and hence would compute Such a calculator would computeĪdhering to the PEMDAS rules, which state that multiplication precedes division, one would compute Some of the early four-key calculators without a stack implement chain input did not obey the PEMDAS rules, but took the easy route and carried out arithmetic computations from left to right without regard to any specific rules. However, what your grade school teacher failed to say is that there are no universally accepted rules for the order in which arithmetic operations should be performed. Using these rules Aunt Sally would interpret Which roughly governs the order in which arithmetic operations should be performed. If you had been paying attention in grade school, you might recall your teacher telling you the easily-remembered PEMDAS rule: The convention that multiplication precedes addition was used in the earliest textbooks dating back to the 16th century. It is a commonly accepted rule that when performing arithmetic operations involving addition and multiplication, one performs multiplication before addition, hence, the mystery expression normally represents the number 7. In other words, which of the two equations is the correct interpretation Represent? Some people say 9, others say 7. For example, what number does the expression Other than the fact that the teacher is probably male and the student female, this story brings up the fact that although grammar is important for precision in natural language, precise rules are also important for making arithmetic unambiguous. There’s the story about the girl in a beginning writing class who tells the teacher that the phrase
