Associated Topics || Dr. Math Home || Search Dr. Math

### Calculators - CORDIC Method

```
Date: 05/16/99 at 03:15:37
From: Warren
Subject: How can a computer or calculator calculate?

How can a computer or calculator calculate square roots, cube roots,
Xth root, x^y, logarithm, sine, cosine, ...?
```

```
Date: 05/16/99 at 06:44:01
From: Doctor Jerry
Subject: Re: How can a computer or calculator calculate?

Hi Warren,

Calculators use what is called the CORDIC method.

TI and HP use several stored constants and calculate the values of
several sequences of numbers, using only addition and multiplication.
They continue the calculation until sufficient accuracy is obtained.

The algorithm looks like this: I'll use x_k to mean x sub k, and
x_{k+1} to mean x sub k+1, and so on.

Let

x_{k+1} = x_k - d_k*y_k*2^(-k)
y_{k+1} = y_k + d_k*x_k*2^(-k)
z_{k+1} = z_k - d_k*s_k

The numbers d_k are equal to the sign of z_k (if z_k >= 0, d_k = 1; if
z_k < 0, then d_k = -1). Also, s_k = arctan(2^(-k)). The numbers s_k
are permanently stored in the calculator, maybe up to k = 50 or so.

Starting values for the calculation are calculated. If z_0 = t is
given, where t is a given angle (in radians), then y_0 = 0 and
x_0 = cos(s_0)*cos(s_1)*...*cos(s_{47}).

As k increases, x_k approaches cos(t) and y_k approaches sin(t).

Similar calculations give other trig functions.

- Doctor Jerry, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
College Algorithms
High School Calculators, Computers

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search