Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Comparison of Algorithms R and F: Convergence Rates and Multiplication Requirements, Study notes of Logic

A comparison of Algorithms R and F in terms of convergence rates and multiplication requirements. It includes sequence diagrams, examples, and simulation results for both algorithms. The document also discusses the organization of Algorithm R for rapid division and square root performance.

Typology: Study notes

2021/2022

Uploaded on 09/12/2022

arij
arij 🇺🇸

4.8

(8)

230 documents

1 / 90

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
TWO
SQUARE
ROOT
ALGORITHMS
UTILIZING
MULTIPLICATION
AS
THE
ITERATIVE
OPERATOR
w4-
k '- i-/f
APPROVED:
N70
-23
320
C3,
W
(ACCtSSION
NISMBEn)
(THRUFI
.....
U
-)
NATIONAL
TECHNICAL-
INFORMATION
SERVICE
U
Seporgmen
of
EVmCE
-_
Springfield
VA
22151
-
2
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf15
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a

Partial preview of the text

Download Comparison of Algorithms R and F: Convergence Rates and Multiplication Requirements and more Study notes Logic in PDF only on Docsity!

TWO SQUARE ROOT ALGORITHMS UTILIZING MULTIPLICATION

AS THE ITERATIVE OPERATOR

w4- k '- i-/f

APPROVED:

N70 -23 320 C3, W

(ACCtSSION NISMBEn) (^) (THRUFI

.....U - ) (^) NATIONAL (^) TECHNICAL- INFORMATION U Seporgmen (^) of (^) SERVICE EVmCE - Springfield_ (^) VA (^22151) -

2

N O T I C E

THIS DOCUMENT HAS BEEN REPRODUCED FROM

THE BEST COPY FURNISHED US BY THE SPONSOR-

ING AGENCY. ALTHOUGH IT IS RECOGNIZED

THAT CERTAIN PORTIONS ARE ILLEGIBLE, IT

IS BEING RELEASED IN THE INTEREST OF MAK-

ING AVAILABLE AS MUCH INFORMATION AS

POSSIBLE.

PRECEDING PAGE^ BLANK NOT^ FILMEO.

ACKNONLEDG4ENTS

The (^) subject for this research was suggested by Professor C. V. Ramamoorthy. (^) In addition, Professor Ramamoorthy provided invaluable (^) assistance by his guidan and encouragement. (^) He made many suggestions which were of great help and for this the author wishes (^) to express his sincere (^) thanks. The author wishes to thank (^) Professor C. H. Roth, Jr.,. for his (^) helpful suggestions and interest as a member of the committee. The author also appreciates the guidance (^) rendered by Professor (^) David M. Young, Jr., in the convergence proofs.

J' R. G.

August, 1969

iii.

ABSTRACT

The hardware algorithms^ are^ presented^ which^ utilize high-speed multiplication^ and^ no^ division^ to^ perform^ the square root^ operation^ rapidly.^ One^ algorithm^ is^ intended for a large general-purpose computer^ and^ in^ addition^ pro vides a second-order division^ scheme.^ The^ second^ al gorithm requires^ a-special^ function^ generator^ which^ is presently utilized in^ certain^ existing^ computers.^ Each algorithm is considered^ for^ convergence^ rate,^ variance, accuracy and implementation. The^ effect^ and^ importance of the initial^ approximation^ is^ considered.^ A^ simulation is performed to^ compare^ each^ to^ a^ conventional^ algorithm. Although both algorithms are^ intended^ strictly^ for^ hard ware implementation,^ either^ may^ find^ an^ application^ using microprogramming, and^ under^ certain^ conditions,^ one^ might be implemented in^ software.

iv

Chapter Page

 - 7.4 Round-off Error 7.3 Variance 6o 
    1. IMPLEMENTATIONS OF ALGORITHMS F AND R
    • 8.1 Algorithm R
    • 8.2 Algorithm R--Division
    • 8.3 Algorithm F
    1. SUMMARY
    • 9.1 Comparisons
    • 9.2 Possible Modifications
    • 9.3 Topics for Further Study
  • REFERENCES

LIST OF TABLES

Table Page 7-1 Maximum Number of^ Iterations^ Required^ to Generate Square^ Root^ with^ an^ 8-bit

Initial Approximation ..........^.^61

7-2 Maximum^ Number^ of^ Iterations^ Required^ to Generate Square Root with a 2-bit Initial Approximation .............. 61 7-3 Maximum Number of Multiplications Required toInitial Generate Approximation Square Root ....... with^ an^ 8-bit .... 62 7-4 Maximum Number^ of^ Multiplications^ Required to Generate Square^ Root^ with^ a^ 2-bit Initial Approximation .......... 62

vii

Figure Page 5-1 Sequence (^) Diagram for Algorithm-F 38

5-2 Ecample, of Algorithm F.. ......... 39

5-3 Minimum Number of Significant Bits (^) vs. ErrorIteration Number^ with^ Initial^ Relative Reciprocal)Fj^ - Generator^ I^ for^ Four Accuracy^ Values ..^ of 45 6-1 Flow Chart for Simulation of Algorithm F (^50) 6-2 Number of Multiplications (^) for a 20-bit ApproximationNumber^ vs.^ Accuracy........^ of^ Initial ....... 52 6-3 (^) Number of Multiplications for a 32-bit NumberApproximation vs. Accura,cy ............... of Initial 53 6-4 Number of Multiplications for a 48-bit Number Approximation vs. Accuracy .... of (^) .......... Initial 54 6-5 Number of Multiplications for a 64-bit NumberApproximation vs. Accuracy ............... of Initial 55 6-6 Number (^) of Multiplications for a 92-bit NumberApproximation vs. Accuracy ............... of Initial 56 7-1 (^) Calculated MinimuM Number of Significant BitsMultiplications of B vs. Number for Algorithmsof Iterations F and and R 58 8-1 Data Flow (^) for Algorithm R. 66 8-2 Data Flow for (^) Algorithm F ......... 70 9-1 Sequence (^) Diagram for Algorithm R Using Two Multipliers (^) ................ (^77)

ix

CHAPTER 1

The i n c r e a s i n g u s e of computers i n s c i e n t i f i c a l l y

o r i e n t e d r e a l - t i m e a p p l i c a t i o n s such a s p r o c e s s c o n t r o l ,

a e r o s p a c e n a v i g a t i o n and guidance, e t c. , h a s p l a c e d new

demands on c o m p u t a t i o n a l speed. T h e r e f o r e , t h e f r e q u e n t l y

used s o f t w a r e a r i t h m e t i c o p e r a t i o n s such a s d i v i s i o n ,

s q u a r e r o o t , a n d p o s s i b l y o t h e r f u n c t i o n s u s i n g a p o l y -

nomial e v a l u a t i o n h a v e t o b e performed i n t h e hardware.

I n t h i s t h e s i s , we a r e concerned w i t h g e n e r a t i n g

and implementing t h e s q u a r e r o o t f u n c t i o n , u s i n g new

t e c h n i q u e s which make u s e of f a s t m u l t i p l i e r s found i n

l a r g e , f o u r t h - g e n e r a t i o n s c i e n t i f i c machines. [ I ] , [ 3 ]

Most g e n e r a l p u r p o s e s c i e n t i f i c machines such a s

t h e CDC 6600, SDS 930, and t h e Honeywell 8200 u s e p r o -

grammed s u b r o u t i n e s t o e v a l u a t e s q u a r e r o o t. These sub-

r o u t i n e s , many of which employ a n i t e r a t i v e d i v i s i o n

a l g o r i t h m , a r e n a t u r a l l y v e r y slow i n comparison t o mul-

t i p l i c a t i o n. On t h e o p p o s i t e extreme some computers

such a s t h e P h i l c o T r a n s a c 1000 have a b u i l t - i n s q u a r e -

r o o t f a c i l i t y. Although a n o r d e r of magnitude i n c r e a s e

i n speed i s p o s s i b l e Poy such a n a d d i t i o n , t h e c o s t of t h e

a d d i t i o n a l h a ~ d i v a r er e q u i r e d can "v p r o h i b i t i v e b e c a u s e

CHAPTER 2

SQUARE ROOT^ TECHNIQUES

2.1 Direct Methods

So far as is known, the only naraware mernoa useo to date to generate square root is a binary equivalent of the paper-and-pencil method everyone learns in grade school. The^ paper-and-pencil^ method^ is^ as^ follows: Pair the digits off both directions from the decimal point. Starting with the left-most pair of digits (or single digit) find-the largest number which, when squared, is less^ than^ the^ digit^ pair.^ Subtract the square^ from^ the^ digit^ pair^ and^ append^ the^ next digitpair. Call^ this^ the^ remainder.^ The^ first digit found is the first digit of the answer. The second digit is determined^ in^ the^ following^ way: Double the answer so far calculated (so far only one digit). Append to that number the^ largest^ digit^ for which the product of the digit and the appended number (i.e., 20 times the answer^ plus^ the^ digit)^ is^ less than the remainder. Subtract that product from the remainder and append the next decimal pair. The remaining^ digits^ are^ calculated^ just^ as^ the second one^ was--finding^ the^ largest^ digit^ which,^ when

4

&ded to 20 times the answer and multiplied by the (81it is less than the remainder. The decimal (^) point U after the same digit (^) as the number of digit pairs to the left of the decimal point of the initial number.. An example is^ given^ in^ Fig.^ 2-1^ for^ the^ root^ of^ 62,138. (^2 4) 9 2 6 21 38 oo 4 441 f2 21 1^ -1^76 F9I45 (^38)

44 Ol

1[37^99^64^36 Fig. (^) 2-1 Decimal Square Root. The binary algorithm is quite (^) analogous to the con %Antional (^) decimal technique. It is as follows (^) with example i n Flg. 2-2. Pair the number off 'in bits both (^) ways from the binary point. If (^) the number is in floating point the exponent Must be an (^) even number and the mantissa must be less than one and (^) greater than or equal to 1/4. The first bit of the (^) result must be ones since the first (^) bit pair

@f the 'ormalized" number must be 11, 10, or 01. Sub-

Tact one from the first bit (^) pair and append the next

6

tha answer is subtracted from the remainder. If it is negative it is added back to the remainder and last answer bit is changed to zero. This is called the restoring

square root algorithm. An^ example^ is^ in^ Fig.^ 2-3.

1 0' 2'^1^01 0 1.

- 1 01

+.l 01

- 10 01

+ 10 1 O~l

- 1. 01 0 01

+ 1 0^10^01

0 0^11^0101 00 00^^01 01

Fig. 2-3 Restoring Square Root

A variation of this algorithm'which is faster but

requires more hardware is the nonrestoring square root

algorithm. In this method, again a one bit is assumed,

but if the difference is negative the number is not added

back in. Instead, on the following cycle the subtrahend

is made by appending a^ pair^ of^ ones^ to^ the^ answer^ thus

far, including the zero bit just determined. This^ number

7

then is added,^ rather^ than^ subtracted^ as^ would^ normally

be done.^ This^ process^ saves^ a^ step^ in^ that^ it^ combines the addition^ with^ the^ next^ subtraction^ for^ each^ time^ the number would^ normally^ have^ to^ be^ restored.^ An^ example is given in^ Fig.^ 2-4. 0 0 0

1 lt 10 01 00 01

- 1 01

1.71501 10 Yo 11

1.1 +^0010 0010

11 10 10 "11 Ol

Fig. 2-4 Nonrestoring^ Square^ Root

The nonrestoring algorithm^ has^ been^ used^ more^ due to the fact^ that^ with^ little^ more^ hardware^ it^ is^ sub stantially faster. It^ is^ used,^ for^ example,^ in^ many airborne computers^ such^ as^ the^ Philco^ Transac-l000.^ For either algorithm^ additional^ hardware^ is^ required^ for Sequencing. In addition^ a^ counter^ is^ necessary^ to^ deter nine completion,^ although^ presumably^ if^ a^ hardware "'vision scheme^ is^ implemented^ using^ subtraction^ as^ the terative operator, the^ same^ counter^ can^ be^ used^ for^ both

9 computer uses this method after generating an initial

approximation with^ maximum^ relative^ error^ less^ than 2.6 x lo-^3.^ [3)^ The^ subroutine,^ in^ addition^ to^ requiring the storage of three constants requires over 200 clock periods to generate the initial approximation and^ go through the four Newton-Raphson iterations required. The SDS 930, which uses the polynomial evaluation for single-precision calculations, utilizes the Newton- Raphson iteration for multiprecision work. Only one iteration is necessary, however, for double precision, since the polynomial evaluation has already generated a single precision initial approximation. Eaoh of these methods reveals inherent problems for hardware implementation. The polynomial approxima tion requires a large number of constants, the number of which increases faster than the word length. The Newton- Raphson technique requires a division bn each iteration,which makes the iteration very slow. Division is a very -,low operation. For example, in the CDC 6600 computer it takes 7.25 times as long as an addition and nearly three times as long as a multiplication. It is so slow, even compared to multiplication, that in some of the newer machines [1) it is being performed using multiplication as the itera tire operator Instead of the traditional subtraction.

Thus the software Newton-Raphson iteration^ becomes

limited by the division rate.

It seems clear,^ therefore,^ that^ if^ an^ algorithm

can be derived which eliminates division^ in^ the^ iteration,

a considerable speed-up can be realized.