3. How Does a Calculator Work?

By M. Bourne

In the Introduction to this chapter, we wondered how a calculator (or computer) finds the square root of millions of numbers, and how it finds the cosine of millions of angles (in degrees and radians).

Calculators and computers do not hold all those answers in their memory chips. In fact, when we ask a computer to find something like sin(1) (that's in radians), it uses the polynomial expansions that we have been talking about earlier in this chapter, in Taylor Series and Maclaurin Series.

Note 1: We are not going to talk about the electronics of a calculator here. We are going to see how calculators and computers calculate most function values.

Note 2: The Maclaurin Series is used by computers (which have hardware multipliers) as described below. On the other hand, calculators do not have hardware multipliers and are more likely to use the CORDIC algorithm.


To find the value of sin 1 (in radians), a calculator will use the Maclaurin Series expansion for sin x, that we found earlier.

`sin x=x-1/6x^3` `+1/120x^5` `-1/5040x^7...`

The calculator substitutes into as many terms of the polynomial that it needs to in order to get the required number of decimal places. Let's say our calculator has 6 decimal place accuracy.

We simulate what the calculator will do by substituting x = 1 into each of the terms and stopping when the accuracy is achieved.

One term (the first term of the series)

`sin 1 ≈ 1`

Two terms

`sin 1~~1-1/(3!)~~0.833333`

Three terms

`sin 1` `~~1-1/(3!)(1)^3+1/(5!)(1)^5` `~~0.841667`

Four terms

`sin 1~~1-1/(3!)(1)^3+1/(5!)(1)^5-1/(7!)(1)^7`


Five terms

`sin 1~~1-1/(3!)(1)^3` `+\ 1/(5!)(1)^5` `-\ 1/(7!)(1)^7` `+\ 1/(9!)(1)^9`


Six terms

`sin 1~~1-1/(3!)(1)^3+1/(5!)(1)^5` `-\ 1/(7!)(1)^7` `+\ 1/(9!)(1)^9` `-\ 1/(11!)(1)^11`


We see that there is no point going any further, since we have already reached 6 decimal place accuracy.

Fourier Series

Now that you have seen Taylor Series and Maclaurin Series, and have seen how a computer uses infinite series to find the value of functions, go and check out Fourier Series, which follows this chapter.