Formulas as they are commonly written use
infix notation for
binary operators, such as addition, multiplication, division and subtraction. This notation also uses: •
Parentheses to enclose parts of a formula that must be calculated first. • In the absence of parentheses,
operator precedence, so that higher precedence operators, such as multiplication, must be applied before lower precedence operators, such as addition. For example, in 2 + 3*4, the multiplication, 3*4, is done first. • Among operators with the same precedence,
associativity, so that the left-most operator must be applied first. For example, in 2 - 3 + 4, the subtraction, 2 - 3, is done first. Also, formulas may contain: •
Non-commutative operators that must be applied to numbers in the correct order, such as subtraction and division. • The same symbol used for more than one purpose, such as - for negative numbers and subtraction. Once a formula is entered, a formula calculator follows the above rules to produce the final result by automatically: • Analysing the formula and breaking it down into its constituent parts, such as operators, numbers and parentheses. • Finding both
operands of each binary operator. • Working out the values of these operands. • Applying the operator to these values, in the correct order so as to allow for non-commutative operators. • Evaluating the parts of a formula in parentheses first. • Taking operator precedence and associativity into account. • Distinguishing between different uses of the same symbol. == Types of calculator ==