Complex Arithmetic Through Cordic
Complex Arithmetic Through Cordic
Complex Arithmetic Through Cordic
jttTOTUMATU
KODAI MATH. SEM. REP.
26 (1975), 176-186
BY SIN HITOTUMATU
Abstract
In order that the present paper may be self-contained, we first briefly sum-
marize the principle of the algorithm.
Let (x,y) be the planar orthogonal coordinates for a point P and introduce
a generalized polar coordinate system (R, A) by
176
COMPLEX ARITHMETIC THROUGH CORDIC 177
Fig. 1.
(2)
Starting from Po^C Xo, yo), we iterate the transformations (2) under suitable
sequence of constants δ0, δlf •••, until we arrive at Pn—(Xn, yn) Then we have
Λn=A0-a
R —R v
where
n-l n-1
(3) .7=0 }=0
(4) zJ+i=Zj+(Xj
simultaneously with (2). Then the final values are given by the followings
m 1/2 1/2
xn=Klx0 cos (m a)+yom- sin (m α)]
1/2 1/2 1/2
yn=Kly<) cos (m a)—x0m- sin (m α)]
zn=z0+a
where a and K are given by (3).
Let us iterate t h e above transformations (2) and (4) under suitable sequence
of constants {δj} in t h e following two w a y s :
If this h a s been done after n steps, the final results will have t h e values a s
in t h e following table 1, where
Noting that
(5) V(t+c)2-(t-c)2 =
the table contains all elementary standard functions such as square root, log, exp,
sin, cos and arctan as well as multiplication and division. It is not difficult to
see that the iteration of case I for m=0 is essentially the non-restorting division
algorithm.
Table 1
Case m
I 1 0
I 0 0
I -1 0 Zo+arctanh (yo/xo)
II 1 Ci(*o cos zo—yo sin z0) Kx{y0 cos z o + x0 sin z0) 0
TT 0 x0 J>o+*o2Ό 0
II — 1 K- L(XQ cosh zo+yo sinh z0) K.x(y0 c o s h ^ 0 + ^ o S i n h z0) 0
COMPLEX ARITHMETIC THROUGH CORDIC 179
Since most of the recent computers use binary system, it is most convenient
J 7 1
to choose δj—±2~ (or ± 2 " " ), j=0,1, 2, ••• up to necessary number of bits N.
When m = — l, slight modification is necessary for the convergence (see §3.1.).
We write
1/2 1/2
£j
=z2->, βj=m- arctan (m 2"0
dj=±.6j, aj = ±βj (with same signatures).
The constants β3 may be precalculated. For convenience, we give the values of
arctan 2~J in decimal and in octal form in the appendix of the present paper υ .
Now, we modify the transformations (2) and (4) in the following form:
for dj>0 for 3,<0
In Case I, we select (6+) if y ^ O , and (β_) otherwise; in Case II, we select (6+)
if Zj<0, and (6_) otherwise.
It is remarkable that the transformation (6+) or (β_) is possible only by
addition, subtraction, shifting and read out of constants, but needs no multi-
plication. Thus, the algorithm is quite suitable for micro-computers without
hardwares for multiplication and division, or for multiple precision arithmetic.
We also remark that the constants β3 are necessary only for j up to N/3t
where N is the necessary number of bits, since
1) The author is much grateful for Mr. S. Yamashita (Fujitsu Co.) who has kindly
computed the necessary constants.
180 SIN HITOTUMATU
When m = l , it is easy to verify (7) for /3; =arctan 2~\ since arctan x is convex
in x^O. Thus the procedure always converges, when the initial argument z0 is
in absolute value less than
7
Σ arctan 2" =1.74 ••• >π/2,
.7=0
which surely covers the closed right half plane. According this fact, it will be
more convenient to normalize the argument of a complex number p+iq in the
inverval [—ττ/2, +π/2], and to permit negative modulus; i.e., when p<0, we
denote in the polar form
p+iq=reiθ, r=-VF+?~<0, -π/2<θ<π/2.
2.2. Multiplication.
The product of two complex numbers a+ib and />+z# is obtained by the
following algorithm.
2. Rotation.
(vi) Put
o
, y o
, zo=θ.
(vii) Operate CORDIC of Case II for m= + l. Then the final values give
operation in the second step. Therefore the algorithm is less efficient than usual
method for single multiplication, even when the real multiplication is .computed
by CORDIC for m=0. However, this may be useful at least in the following
cases. First is the case when the multiplier p+iq is previously given by its
polar form, e. g. as in the complex Fourier transform. Second is the case when
we repeat multiplications with same multiplier as in the Horner's scheme for the
computation of a polynomial.
2.3. Division.
When m= —1, the sequence /3; =arctanh 2~3 0 = 1 , 2, •••) does not satisfy the
convergence condition (7), since arctanh x is concave in x^O. However, we have
following relation:
182 SIN HITOTUMATU
As there is no proof in Walther [2], we shall give here a brief proof to (10).
Since
ΛfZ ΛL-5
χ
arctanh x—xΛ—g-+-c—1~ **'» \ \ <1
and since the linear term satisfies (7) with equality, we have
βj- " Σ βk- βn-i=4r(2~Sj-
k=j+ι o
-^2-'+-f 2-'+
Here we are mainly concern with Case I to obtain square root by (5).
Contrary to the case of m = l , we must remark carefully the convergence region
for m = —1. The process converges if and only if the initial values (x0, y0) satisfy
the condition
Even when (11) is not satisfied, the process itself stops after finite number of
steps, but non-convergence means that the value of y does not approach 0, and
hence the final values x and z have no meanings.
If we start from
o
+ , yo = t—C
(11) gives the restriction
COMPLEX ARITHMETIC THROUGH CORDIC 183
x 2C 1
Q' <t/c<Q , Q=e =9.35 - , Q" =0.1068 - .
When we compute the square root of a real number, it will be convenient to
take the constant c such that
c=co=l/4A"_?=O.364512292144
where
U=(ΠX Π )(l-2-2')=0.685847927146 ,
rather than to take c=l/4 as is indicated in [2]. Then the process converges
for
(12)
which surely covers the interval
1/4^ t^l or
Outside the interval (12), we need scaling.
If we operate CORDIC of Case I for m— — 1, we have simultaneously
The final value x+iy gives one of the square roots of p+iq. Another one
is —x—iy.
Let us explain the meaning of the constant cλ. Since the modulus of the
final value through Algorithm 2 is
part in the result if p+iq is real negative (i.e., q—0, p<0), because of the error
in the numerical value of cos(π/2) by CORDIC.
Appendix Table 2
Decimal representations of arctan 2~3
1 0.46364 76090 00806 11621 42562 31461 21440 20285 37054 28612
2 0.24497 86631 26864 15417 20824 81211 27581 09141 44098 38118
3 0.12435 49945 46761 43503 13548 49163 87102 55731 70191 76980
4 0.06241 88099 95957 34847 39791 12985 50511 36062 73887 79749
5 0.03123 98334 30268 27625 37117 44892 49097 70324 95663 72540
6 0.01562 37286 20476 83080 28015 21256 57031 89111 14139 80090
7 0.00781 23410 60101 11129 64633 91842 19928 16212 22811 72501
8 0.00390 62301 31966 97182 76286 65311 42438 71403 57490 11520
9 0.00195 31225 16478 81868 51214 82625 07671 39316 10746 77723
10 0.00097 65621 89559 31943 04034 30199 71729 08516 34197 01581
11 0.00048 82812 11194 89827 54692 39625 64484 86661 92361 13313
12 0.00024 41406 20149 36176 40167 22943 25965 99862 12417 79097
13 0.00012 20703 11893 67020 42390 58646 11795 63009 30829 40901
14 0.00006 10351 56174 20877 50216 62569 17382 91537 85143 53683
15 0. 00003 05175 78115 52609 68618 25953 43853 60197 50949 67511
16 0. 00001 52587 89061 31576 21072 31935 81269 78851 37429 23814
17 0.00000 76293 94531 10197 02633 88482 34010 50905 86350 74391
18 0,00000 38146 97265 60649 62829 23075 61637 29937 22805 25730
19 0." 00000 19073 48632 81018 70353 65369 30591 72441 68714 34216
20 0.00000 09536 74316 40596 08794 20670 68992 31123 90019 63412
Octal representations of arctan 2~3
1 0.35530 63405 30335 51732 12677 44213 66274 16506 40333 41202
2 0.17533 35374 45440 15654 25333 43636 75373 64205 76265 23772
3 0.07752 67246 52605 73334 31310 45714 23717 50421 67570 54712
4 0.03775 25566 71317 67516 15545 44744 55601 61340 65211 43160
5 0.01777 52533 56513 54222 50235 71656 73335 52143 04116 00332
6 0.00777 75252 67355 62465 33574 74305 31000 53735 40220 20357
7 0. 00377 77525 25567 35227 13200 30432 43756 76301 27507 32053
8 0.00177 77752 52533 56733 45135 42253 73326 66517 37413 17406
9 0.00077 77775 25252 67356 72456 24653 36526 01045 07164 36220
10 0.00037 77777 52525 25567 35667 12271 32003 17674 72457 46466
11 0.00017 77777 75252 52533 56735 65134 51354 22542 22501 17160
12 0.00007 77777 77525 25252 67356 73556 24562 46533 65335 74736
13 0. 00003 77777 77752 52525 25567 35673 52271 22713 20032 00304
14 0.00001 77777 77775 25252 52533 56735 67334 51345 13542 25422
15 0.00000 77777 77777 52525 25252 67356 73567 24562 45624 65336
16 0. 00000 37777 77777 75252 52525 25567 35673 56671 22712 27132
17 0. 00000 17777 77777 77525 25252 52533 56735 67356 51345 13451
18 0. 00000 07777 77777 77752 52525 25252 67356 73567 35562 45624
19 0. 00000 03777 77777 77775 25252 52525 25567 35673 56735 22712
20 0. 00000 01777 77777 77777 52525 25252 52533 56735 67356 73345
186 SIN HITOTUMATU
REFERENCES