There are various ways in which calculators interpret keystrokes. These can be categorized into two main types:
On a single-step or immediate-execution calculator, the user presses a key for each operation, calculating all the intermediate results, before the final value is shown. On an expression or formula calculator, one types in an expression and then presses a key, such as "=" or "Enter", to evaluate the expression. There are various systems for typing in an expression, as described below.
Immediate execution
The immediate execution mode of operation (also known as single-step, algebraic entry system (AES) or chain calculation mode) is commonly employed on most general-purpose calculators. In most simple four-function calculators, such as the Windows calculator in Standard mode and those included with most early operating systems, each binary operation is executed as soon as the next operator is pressed, and therefore the order of operations in a mathematical expression is not taken into account. Scientific calculators, including the Scientific mode in the Windows calculator and most modern software calculators, have buttons for brackets and can take order of operation into account. Also, for unary operations, like √ or x2, the number is entered first, then the operator; this is largely because the display screens on these kinds of calculators are generally composed entirely of seven-segment characters and thus capable of displaying only numbers, not the functions associated with them. This mode of operation also makes it impossible to change the expression being input without clearing the display entirely.
The 1+2×3 examples have been given twice. The first version is for simple calculators, showing how it is necessary to rearrange operands in order to get the correct result. The second version is for scientific calculators, where operator precedence is observed. Different forms of operator precedence schemes exist. In the algebraic entry system with hierarchy (AESH), the precedence of basic mathematical operators is taken into account, whereas calculators with algebraic entry system with parentheses (AESP) support the entry of parentheses. An input scheme known as algebraic operating system (AOS) combines both. This is the name Texas Instruments uses for the input scheme used in some of its calculators. Immediate-execution calculators are based on a mixture of infix and postfix notation: binary operations are done as infix, but unary operations are postfix. Because operators are applied one-at-a-time, the user must work out which operator key to use at each stage, and this can lead to problems. When discussing these problems, Harold W. Thimbleby has pointed out that button-operated calculators "require numbers and operation signs to be punched in a certain order, and mistakes are easy to make and hard to spot". Problems can occur because, for anything but the simplest calculation, in order to work out the value of a written formula, the user of a button-operated calculator is required to:
Rearrange the formula so that the value can be calculated by pressing buttons one at a time, while taking operator precedence and parentheses into account. Use memory buttons to ensure that operations are applied in the correct order. Use the special buttons ± and 1/x, that do not correspond to operations in the formula, for non-commutative operators. Mistakes can be hard to spot because:
For the above reasons, the sequence of button presses may bear little resemblance to the original formula. The operation carried out when a button is pressed is not always the same as the button, but could be a previously entered operation.
Examples of difficulties The simplest example given by Thimbleby of a possible problem when using an immediate-execution calculator is 4 × (−5). As a written formula the value of this is −20 because the minus sign is intended to indicate a negative number, rather than a subtraction, and this is the way that it would be interpreted by a formula calculator. On an immediate-execution calculator, depending on which keys are used and the order in which they are pressed, the result for this calculation may be different. Also there are differences between calculators in the way a given sequence of button presses is interpreted. The result can be:
−1: If the subtraction button − is pressed after the multiplication ×, it is interpreted as a correction of the × rather than a minus sign, so that 4 − 5 is calculated. 20: If the change-sign button ± is pressed before the 5, it isn't interpreted as −5, and 4 × 5 is calculated. −20: To get the right answer, ± must be pressed last, even though the minus sign isn't written last in the formula. The effects of operator precedence, parentheses and non-commutative operators, on the sequence of button presses, are illustrated by:
4 − 5 × 6: The multiplication must be done first, and the formula has to be rearranged and calculated as −5 × 6 + 4. So ± and addition have to be used rather than subtraction. When + is pressed, the multiplication is performed. 4 × (5 + 6): The addition must be done first, so the calculation carried out is (5 + 6) × 4. When × is pressed, the addition is performed. 4 / (5 + 6): One way to do this is to calculate (5 + 6) / 4 first and then use the 1/x button, so the calculation carried out is 1/[(5 + 6)/4]. 4 × 5 + 6 × 7: The two multiplications must be done before the addition, and one of the results must be put into memory. These are only simple examples, but immediate-execution calculators can present even greater problems in more complex cases. In fact, Thimbleby claims that users may have been conditioned to avoid them for all but the simplest calculations.
… excerpt ends here. Continue reading the full article.





