A Unified Algorithm For Elementary Functions
A Unified Algorithm For Elementary Functions
by J. S. WALTHER
Hewlett-Packard Company
Palo Alto, California
379
where
n-l CONVERGENCE SCHEME
a=Lai (11)
i=O The angle A of the vector P may be forced to zero
n-l by a converging sequence of rotations ai which at each
K=IIKi (12) step brings the vector closer to the positive x axis.
i=O
z
Y
Z ,----+0
i
'1' ~~~
y
z
Y
Z
0
-1
z + tan (y/x)
xn =K {xo cos (am I/2 ) +yoml/2 sin (am I/2 ) } (14) y --J--~LY + xz
Yn = K {yo cos ( aml/ 2) - xom-1/2 sin ( aml/ 2) } (15) z~t- Z i~o
LINEAR (m-O). z ... 0 LINEAR (m-O). A ... 0
zn=zo+a (16)
where a and K are as In equations (11) and (12).
'->~'-'''' -" + , .......) x~HX _iC_ 1 l"T7
TABLE I-Angles and Radius Factors
Y ~ __~----41t_1 (Y cosh z + x sinh z) y ~ ._Y_!---7 0
z~~z_l-~o z ~~~ z + tanh
-1
(y/x)
0 ~i 1
-1 tanh-l~i (1_~~.2)1I2
Figure 2-Input-output functions for CORDIC modes
The magnitude of each element of the sequence may be TABLE II-Shift Sequences for a binary code
predetermined, but the direction of rotation must be
determined at each step such that coordinate domain of radius
radix system shift sequence convergence factor
(22) p m Fmi; i~O max I Ao I K
Domain of
Identity Domain Convergence
IDI<~=157
2 . 1.74
2Q
sinh(Q loge2+D) =2" [cosh D+sinh D-2-2Q(cosh D-sinh D)] 1D 1<loge2 =0.69 1.13
2Q
cosh(Q loge2+D) =2" [cosh D+sinh D+2-2Q(cosh D-sinh D)] 1D 1<loge2 =0.69 1.13
EXTENDING THE DOMAIN of a large argument we first shift the argument's binary
point E places until it is just to the left of the most
The limited domain imposed by the convergence significant non-zero bit. The fraction M then satisfies
criterion (25) may be extended by means of the pre- 0.5 ~M < 1.0 and as shown in the table therefore falls
scaling identities shown in Table III. For example, to within the domain of convergence. The answer is calcu-
calculate the sinc of a large argument, we first divide lated as logeM + E loge2.
the argument by 7r/2 obtaining a quotient Q and a re-
mainder D where I D I< 7r/2. The table shows that
only sin D or cos D need be calculated and that 7r/2 is ACCURACY
within the domain of convergence. Note that the sine
and cosine can be generated simultaneously by the The accuracy at the nth step is determined in theory
CORDIC algorithm and that the answer may then be by the size of the last of the converging sequence of
chosen as plus or minus one of these according to Q rotations ai, and for large n -is- approximately equal in
mod 4. As a second example, to calculate the logarithm digits to Fn-l. The accuracy in digits may conveniently
END
TABLE IV-Maximum Execution Times
APPENDIX
ACKNOWLEDGMENTS