CORDIC2.TXT

From steinmetz!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!agate!pasteur!ames!ll-xn!vanhove Fri Feb 26 11:12:41 1988
Path: beowulf!steinmetz!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!agate!pasteur!ames!ll-xn!vanhove
From: vanhove@XN.LL.MIT.EDU (Patrick Van Hove)
Newsgroups: comp.graphics
Subject: Re: CORDICS
Message-ID: <923@xn.LL.MIT.EDU>
Date: 26 Feb 88 16:12:41 GMT
Organization: MIT Lincoln Laboratory, Lexington, MA
Lines: 57
In-reply-to: turk@apple.UUCP's message of 18 Feb 88 02:19:06 GMT


	Thanks to "Turk" for posting the CORDIC scheme + code.

I have a few comments which readers may find useful


First, I think the expression for the rotation should be
 in terms of PRODUCTS instead of SUMS

	                                        -i
	[ x' ]                      [ 1     -d 2   ] [ x ]
	[    ]                      [         i    ] [   ]
	[    ] = Prod { C  } Prod { [    -i        ] [   ] }
	[ y' ]    i      i    i     [ d 2      1   ] [ y ]
				       i

(a look at the code will assure you that this is what's implemented)

Second, in the above expression, C_i =  cos (atan (2^-i))

In the implementation, if you wondered what the numbers are in the first page:

># define COSCALE 0x22c2dd1c	/* 0.271572 */
>
>static long arctantab[32] = {
># ifdef DEGREES		/* MS 10 integral bits */
># define QUARTER (90 << 22)
>	266065460, 188743680, 111421900, 58872272, 29884485, 15000234, 7507429,
>	3754631, 1877430, 938729, 469366, 234683, 117342, 58671, 29335, 14668,
>	7334, 3667, 1833, 917, 458, 229, 115, 57, 29, 14, 7, 4, 2, 1, 0, 0, 
># else
># ifdef RADIANS	/* MS 4 integral bits */
># define QUARTER ((int)(3.141592654 / 2.0 * (1 << 28)))
>	297197971, 210828714, 124459457, 65760959, 33381290, 16755422, 8385879,
>	4193963, 2097109, 1048571, 524287, 262144, 131072, 65536, 32768, 16384,
>	8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0, 0, 
># else
># define BRADS 1
># define QUARTER (1 << 30)
>	756808418, 536870912, 316933406, 167458907, 85004756, 42667331,
>	21354465, 10679838, 5340245, 2670163, 1335087, 667544, 333772, 166886,
>	83443, 41722, 20861, 10430, 5215, 2608, 1304, 652, 326, 163, 81, 41,
>	20, 10, 5, 3, 1, 1, 
># endif
># endif
>

it turns out that COSCALE is the product of all the C_i's,
and that the numbers in arctantab are the sequence of angles:

	arctan ( 2^-i ), for i = -1, 0, ..., 30

normalized so that 90 degrees is equal to QUARTER.

I hope I saved the time of some readers in figuring this out.

	Patrick Van Hove


�