TOPICS
Search

CORDIC Algorithm


CORDIC (coordinate rotation digital computer) is an iterative algorithm that approximates a planar rotation using addition, subtraction, and shifts of binary digits. Volder (1959) used it to compute trigonometric functions and their inverses.

In circular rotation mode, start with a vector (x_0,y_0) and a target angle z_0 with |z_0|<=pi/2. At step i, take d_i=1 if z_i>=0 and d_i=-1 otherwise. Compute

x_(i+1)=x_i-d_i2^(-i)y_i
(1)
y_(i+1)=y_i+d_i2^(-i)x_i
(2)
z_(i+1)=z_i-d_iarctan(2^(-i)).
(3)

The first two updates rotate the vector by d_iarctan(2^(-i)) and multiply its length by sqrt(1+2^(-2i)). The third update tracks the angle still to be applied. The arctangent values can be tabulated in advance, and multiplication by 2^(-i) is a binary shift in fixed-point arithmetic.

After n steps, divide the coordinates by the common scale

 G_n=product_(i=0)^(n-1)sqrt(1+2^(-2i)).
(4)

In exact arithmetic the resulting vector is rotated by z_0-z_n, with z_n->0 as n->infty. For example, starting with (x_0,y_0)=(1/G_n,0) gives approximations to cosz_0 and sinz_0 without a final rescaling. In vectoring mode with x_0>0, choose d_i=-1 when y_i>=0 and d_i=1 otherwise. With z_0=0, the iteration drives y_i toward zero, while z_i approaches arctan(y_0/x_0) and x_i/G_i approaches sqrt(x_0^2+y_0^2).

Walther (1971) unified the circular algorithm with linear and hyperbolic variants for evaluating other elementary functions, including logarithms and exponentials.


See also

Elementary Function, Rotation Matrix, Trigonometric Functions

Explore with Wolfram|Alpha

References

Volder, J. E. "The CORDIC Trigonometric Computing Technique." IRE Trans. Elec. Comput. EC-8, 330-334, 1959. https://doi.org/10.1109/TEC.1959.5222693.Walther, J. S. "A Unified Algorithm for Elementary Functions." In Spring Joint Computer Conference, pp. 379-385, 1971. https://doi.org/10.1109/AFIPS.1971.14.

Cite this as:

Weisstein, Eric W. "CORDIC Algorithm." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/CORDICAlgorithm.html

Subject classifications