BHEaH mm SuS EHH9 MnMflnaMHni % HP H SB mi m i Snclmfl Ml m ^m H ' •■ 888 1 1 ■ hfe ■ ■ LIBRARY OF THE UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAICN 510.84 IA6v ho. 69 1 -696 ?• cop. 2. The person charging this material is re- sponsible for its return to the library from which it was withdrawn on or before the Latest Date stamped below. Theft, mutilation, and underlining of books are reasons for disciplinary action and may result in dismissal from the University. UNIVERSITY OF ILLINOIS LIBRARY AT URBANA-CHAMPAIGN L161 — O-1096 uiucDcs-R-75-693 ynajtA On a Negative Result Regarding The Use of Continued Fractions for Digital Computer Arithmetic by Kishor Shridharbhai Trivedi January 1975 UIUCDCS-R-75-693 On a Negative Result Regarding the Use of Continued Fractions for Digital Computer Arithmetic by Kishor Shridharbhai Trivedi January 1975 Department of Computer Science University of Illinois at Urbana- Champaign Urbana, Illinois This work was supported in part by the National Science Foundation under Grant No. US NSF GJ 382 Ok. Digitized by the Internet Archive in 2013 http://archive.org/details/onnegativeresult693triv Ill Acknowledgment The author wishes to thank Professor James E. Robertson for his continued support and encouragement. Thanks are also due to Mrs. June Wingler for typing this paper. 1. Introduction It was demonstrated by DeLugish [1] that number representations other than the traditional positional notation are useful. This led to a search for new number representations. There seem to be several basic requirements for a proposed representation of numbers to be useful for implementation in hardware [2]. These are the following: Requirement 1: Conversion to the conventional positional notation should be simple. Requirement 2 : The set of numbers representable should be a complete set [3]. In other words, the range of numbers representable should be an interval of the real numbers. Requirement 3: It should be possible to define a broad class of algorithms that are easily soluble for the representation of numbers used. Hardware- compatibility among the algorithms is also desirable. Requirement k: For algorithms which require trial and error procedure, it should be possible to devise techniques such that the coefficient-selection is practical (cf. , quotient -digit selection in division). For continued fractions, a simple conversion procedure to positional notation is well known [2,U], Conditions for completeness of the set of representable numbers were established for the special case when all partial numerators are equal to 1 [5]. In this paper we study the problem of completeness for the more general case when the partial numerators and partial denominators belong to finite and positive sets. The requirement of the identification of a broad class of algorithms seems to be a difficult problem. A limited class of quadratics can be solved using continued fractions [2], This was later extended to polynomials of degree larger than 2 [6], It was shown that the Riccati differential equation is closed under a bilinear transformation [7]. This led to continued fraction algorithms for a multitude of functions [8]. In this paper we present a new algorithm for the evaluation of logarithm. The requirement of an appropriate selection procedure is another difficult problem. For the solution of quadratics, a selection procedure has been obtained [2,5] and later extended to higher degree polynomials [6]. For algorithms based on Riccati equation, intensive efforts have been made but as of now no success has been made [8]. We will show that, under certain reasonable constraints, it is impossible to obtain a suitable selection procedure for the algorithm for logarithm proposed in this paper, 2. On Digit Sets Let P l f = q l + P 2 ^ denote an infinite continued fraction such that Vi > 1. p. e S and — l p q. e S . Where S and S are fixed sets. p. 's are called partial l q p q *l * numerators and q_^ 's are called partial denominators. In this paper, we will require that S and S are finite and positive sets. Let P^-., = m i n S , p = max S , q. = min S , and q_ = max S . Quite mm p' ^max p 7 ^mm q' Tiiax q clearly, the smallest number m, representable as an infinite continued fraction then is given by, P • P P • mm max mm m = Ttiax Tirm inax P • mm Tiiax max Tnin + m Therefore, m is the positive solution of the quadratic, 2 Snax Tiiax Tain ^max ^min min inin Similarly, the largest number representable as an infinite continued fraction, denoted by M, is the positive solution of the quadratic M q . + M(q_ q +P--P )~P q„ =0 (2) Trim Tmn Tiiax mm max max inax It is clear that, < m < M < oo. In particular, m = M iff p = p . and q__ = q_. , i.e., when 7 r max mm inax inm 7 both S and S are singleton sets. P q Def 1: For p e S and q e S define the interval I = [m , M by : p q pq pq pq m = -E— and M = -£— . pq q+M pq q+m Now we state and prove the following theorem. Theorem 1 : The set of numbers representable as infinite continued fractions using the digit set S and S is complete iff P q i ss - u i -M. p q pes-*" 4 q £ S Proof : First assume completeness. Then, V f e [m,M] there is an infinite c.f. using the digit set S and S . From the definition of I , we immediately conclude that I c [m.Ml. To prove that [m,M] c I a a , assume the contrary. Then Sb — — DO p q p q there is an interval I c [m,M] such that I $£ I for any p e S and q e S , Choose any f e I. Because of completeness, f= P i P 2 ' *i q{ + q^ + ' q i + f i f_ e [m,M] and p' € S , q' e S 1 ' ^1 p 7 ^1 q But then f e I , , which is a contradiction. Therefore, we have P{q{ proved the 'only if part of the theorem. To prove the 'if part of the theorem, we have to show that for each f e [m,M] there is an infinite c.f. expansion. First we give a rule for generating an infinite c.f. and later show that in the limit this c.f. converges to f . The first step is to find p., e S and q_ e S such c 1 p 1 q that f e I . By the given conditions, we are always guranteed at least P l one such pair (p , q ). Now observe that if we let f_ = z— then, f e [m, M] . Therefore, the obove rule can be applied recursively and thus generating an infinite continued fraction. P l P 2 P l Let the finite continued fraction — — . . . + — be denoted by p P qi v % ^ and let f = | 3 + ... + ^H_ . tatting, P Q . 0, % = 1, P^ - 1, Q, = the recursions for P and are given by [k] : P n + 1 = P n + 1 P n-1 + Vl P n *** Vl = p n + l Vl + Vl Q n ' Also, Let Therefore, or P = P + f P _ n n n-1 ^«a tf „Vl _ = _ + 5 then, Q 0^ n _ P + f P . P _ n n n-1 Q " ft + f Q ti n n-1 n n-1 / n ti-I n ^ + Q i Q 7i n-1 n f Q . 1+ n n-1 Si ( p 5 ) + (£ - B J, V Q n' V Q n-l y ' f n Vl S Q - ., n n-1 1+ \ 5 i f GL i c- n-1 n Ti-1 o + P n Q n Q f Q , n n n-1 a f , f a c 5 6 n-1 n n-2 n " n-2 " Q^ 5 _ f _ f n-2 n-1 n Vi V 2 "» Vi + P » V7 & n -2 Wrr - V Si-1 where — = t P n + Si T n-1 ' V; = 5 [ P n " *n f n-l ] n " 2 P n + Si Vl n . „ n since a > 0, n-1 f . > m > 0. n-1 — n " 2 p n + Si T n-2 p A = S <1 r n ti n-1 if p > 0, a > and t , > 0. . r n Ti n-1 Clearly, all the conditions are satisfied for n > 2. Therefore, we have, 5 < 6 _ for n > 2. n n-2 - P It is also clear that 6 and 5 are finite. Therefore — converges 1 Q n to f as n approaches infinity. Thus we have proved the theorem. As an example, the digit sets S = {1} and S = {1,2} imply incompletene since m = O.366, M = 0.732, m = O.366, M = 0.^2266, m = 0.57737 and M = 0.732. Note the gap between I _ and I . The digit sets S = {1} and S = {1,1/2} imply completeness since m = 1/2, M = 1, m = l/2, Si M , -, = 2/3, m , /p = 2/3 and M /„ = 1. In the classical theory of continued fractions, S = {11 and S = the set of positive integers is P q used. Note that |s | is infinite. It is easy to see that if we let S = {1} and S to be any finite subset of positive integers, we do not have completeness. Given S and S , if we have completeness then the set of numbers representable as infinite c.f. ' s will be called a number system (NS). Def 2: A number system is nonredundant if Vp , p e S and 1 d p q n , q^ e S , I HI is either null or singleton. H l' ^2 q' p 1 q 1 p^ A number system is redundant if it is not nonredundant. As an example, NS defined by S = {1) and S = {1,1/2} is nonredundant since I , = [1/2,2/3] and I _#p = [2/3,1] and I , D I / p = {2/3} which is a singleton. Similarly NS defined by S = {1} and S = positive integer is nonredundant [9]. It is clear that for a nonredundant number system, the choice °f (p> 0.) pair is unique for f e [m,M] unless f is the boundary point of two adjacent intervals I and I , ,. By an arbitrary rule of assignment we can easily make the choice of (p, q) pair unique. 3. An Algorithm for Logarithm Assume that we want to evaluate tog. a n« Form a sequence -1 a , a , a , ... such that, p i+i ton. a. = ■ — : *a. ,i q. , + tog. a. , l-l u+1 *a. l+l then P i + 1 a. a. , i l-l Vl + ^a. a i + l or, or, 3 i + l^a. a i-l = Vl + ^a. a i + l P i + 1 a. l (a i-l } ' " " ^a. a i + l = Vl or, P i + 1 a. l ((a.^) " /(a. +1 )) = q 1+1 8 or, a. = (a.^) /a i+1 or, (a i-l } a. , = 1+1 A+l (a,) l' Simultaneously, we obtain a continued fraction expansion of ha a. as a-1 P l P 2 q 1 + Qg + Based on this analysis, we can write the following continued fraction algorithm for evaluating (bg> a . a-1 ALG Al: [step 1] : Initialize a. , a ,; Set P Q , Q_ x - 0; P_ r Q Q «- 1; i - 0; [step 2]: Select p ±+1 , qLj^j [step 3]: P i+1 - P 1+1 P^! + Vl V Vl^ p i + 1 Q i-1 + Vl V < a i-l> P i + 1 a i+l ' q- -, ' [step k]: After a sufficient number of iterations, GO TO step 5; else i «- i + 1 and GO TO step 2; P. [step 5]: ha a n ~ ' a-1 ° " \ + l End Al; We observe that the computation of a. - in step 3 of Al requires two exponentiations and one division. With the help of the following theorem, we are able to simplify this computation. Thm 2 : / (a -l) bl a. 1 K, 1 ) and and where j = 1 if i is odd = -1 if i is even, b. = p. b + q . b. l l i-2 TL i-I d. = p. d. _ + q. d. _ for i > 2 l l 1-2 TL i-I - Proof : The proof is by induction on i. For i = -1, we have, 1 a -1 a -1 Also and therefore, b = 1, d = 0\ -1 a = -1 a Q I and therefore, b =0, d = 1. Now assume, inductively, that the theorem is true for i < i. a. , l+l K-l) ■i+1 (a.) 1+1 let j = 1 if i + 1 is odd and -1 otherwise. Then, -J 10 a. = i -1 d. l and i-1 -1 "i-1 i-1 Therefore, -1 -A J l P i+l b. l J i q i + 1 1+1 -1 i-1 j / p. _,b. , + q_. ,b. / ^l+l 1-1 ^1+1 1 -1 » a ^i+l l-l T.+1 l which gives the required result. From the recursions of b. , , d. .,, P. _,, 0. _ and the initial i+l' i+l' i+l' a+1 conditions we note that b. = P. and d. =0. for all i > - 1. Therefore, liii. — we have, / P. - J a 11 Explicit computation of a. , can be avoided if the selection of p. and q. in step 2 of Al can be done with the help of P. and Q. . As a result, we have a very simple algorithm for evaluating fog. a . ALG A2: [ step 1] : Initialize a~, a ; Set P Q , Q_ x - 0; P_^ Q Q - 1; i - 0; [step 2]: Select p 1+1 , q i+1 ; [step 3]: P. +1 <- P±+1 T ± _ ± + q. +1 P.; [step h]: After a sufficient number of iterations, GO TO step 5; else i <- i+1 and GO TO step 2; P. +1 [step 5] : foa a ~ -i — ; a -l U S.+1 End A2; We note that the complexity of algorithm A2 depends largely on the complexity of steps 2, 3 and k which are executed repeatedly. We will discuss the details of step 2 in the next section. Step 3 involves four multiplications and two additions. By requiring that the digit sets S and S of p. and q. respectively, consist only of powers of two, we reduce the multiplications to simple shifts [2,5]. Also note that, the computation of P. and Q. can be done in parallel. h. Selection Procedure Given ha a. we want to determine p, q such that ha a. e I or *a. , l *a. ., l pq l-l l-l m < foq. a. < M pq - & ± _2. x ~ pq or m M a. P ? < a. < a. P ? l-l — i — l-l 12 This procedure has two drawbacks. First it requires the explicit computation of a. and second it is quite complex since two exponentiations are required. To remove the first difficulty, we have to express the above condition in terms of P. , Q. . First note that, Bog. a. a -l - 1 " Bon a = = therefore, the selection condition is: ^ a i-i i V^i-i dog. a. St -| 1 m < : — < M pq - % a a i _ 1 - pq We claim that since which implies a. . > i > a , l-l — < m < ba a. < M — *a. , l — l-l 1+ 1 »<• ^ 1+ 1 m ^ m ^ ^ M ^ M a, < a. , < a. < a. , < a , -1 — i-l — i — i-I — -1 which implies < m 1+1 < ha a. < M 1+1 . — *a 1 l — We can, therefore, write the selection condition as, m bg. a. _ < bq. a. < M ha a. . . pq *a i-l — y a _ l — pq a , i-l Now from theorem 2, we have, a.^i ■ 3(i) [P i »». m -l " Q i ^a a oJ = j(i) [P. - u Q.] where u = % a . 13 Therefore, the selection condition is given by 3 (i-l>» M [ *!.!-%_!»] < JU)[ Wl * J( i - 1 )V P i-l- Q i-l U] noting that j (i-l) = -j(i) and transposing, we have, M P. n +P. m P. ,+P. JUJ M Q. n +Q. - U jUj - JUJ m Q. .,+Q. * pq i-l l pq i-l l Note that we cannot use this as our selection rule since u is the unknown to he evaluated. To verify the consistency of this inequality, we must have M P. .,+P. m P. n +P. pq i-l i pq^L-i l or j(i)[(M -m )P. n Q.] < j(i)[(M -m )P.Q, .] ° v pq pq i-i i - pq pq i i-l or P. 1 P. j(i) f:- J ' (i) ^ i-i i Since j(i) = 1 if i is odd and -1 if even therefore the above follows from the well known property of convergents of continued fractions [10], This property can be stated as P P P P 2 3 1 ^5^5-..<"<...<^5^- Since a is a monotone increasing function of x (since a > l) we can rewrite the selection condition as M P. .,+P. m P. +P. pq i-l l pq i-l l . ,.\ pq i-l i . . /.% . pq i-l a j(i) a_£^ < a -j(i) < a_£ H 14 This selection rule suffers from the drawback that it requires too much computation. In fact it requires exponentiations. If we were to avoid this, we have to use an approximation of the quantities ARG. (M ) AEG. (m ) L X Pq and Kl X ^ where s P. + P. ARG.(s) . - 1 " 1 - n X . This immediately implies that we have to use a redundant number system, since if we use a nonredundant NS and an approximation in the selection rule then the selection can not always be guaranteed to be correct. Let us assume that 3 p', q', p", q" such that, m , , < m < M . , < M and p'q 1 pq p'q' pq m < m „ „ < M < M „ „ pq p"q" pq p'q' thus l(p'q',pq) = [m ,M , f ] allows us to choose either (p',q') or (p, q] and the interval l(pq,p"q") = [m „ ,„M ] allows us to choose (p, q) or (p "* 1 then -i I s l~ s 2 I I AEG (s„ ) - ARG. (s~) < cc . But this means that the maximum 1 i 1 i 2 ' s, allowable error in the approximation of X.(s) rapidly approaches zero. This immediately shows that an approximation cannot be allowed in the selection rule. 5. Conclusion The practicality of continued product representation of numbers has given rise to an interest in unconventional representations of numbers for use in digital computer arithmetic. Continued fraction representation has been studied for some time. In this paper we establish the conditions for completeness of the representation. We propose an algorithm for logarithm and show that a practical procedure for the selection of partial numerators and denominators does not exist. Currently, we are in the process of obtaining similar negative results for functions evaluated using the Riccati equation approach. We conjecture that the solution of a polynomial equation is the only problem that can be solved in our formulation. 17 List of References [1] DeLugish. B. G., "A Class of Algorithms for Automatic Evaluation of Certain Elementary Functions in a Binary Computer, " Ph.D. Dissertation, University of Illinois, Urbana, June 1970; also Department of Computer Science Report 399. [2] Robertson, J. E. and K. S. Trivedi, "The Status of Investigations into Computer Hardware Design Based on the Use of Continued Fractions, " IEEE Transactions of Computers , Vol. C-22, No. 6, June 1973, pp. 555-560. [3] Goldberg, R. R., "Methods of Real Analysis, " Blaisdell Publishing Company, New York, 1965. [k] Wall, H., "Analytic Theory of Continued Fractions," Van Nostrand, Princeton, New Jersey, 1950. [5] Trivedi, K. S., "An Algorithm for the Solution of a Quadratic Equation using Continued Fractions," M.S. Thesis, University of Illinois, Urbana, June 1972; also Department of Computer Science Report 525. [6] Bracha, A., "A Method for Solving Polynomial Equations by Continued Fractions, " IEEE Transactions on Computers , Vol. C-23, No. 10, October 197U, pp. 1093-1097. [7] Wynn, P., "On Some Recent Developments in the Theory and Application of Continued Fractions, " Journal SIAM on Numerical Analysis , Vol. 1, pp. 177-197, 1961*. [8] Trivedi, K. S., "The Use of Riccati Equation in Digital Computer Arithmetic, " University of Illinois, Department of Computer Science Report UIUCDCS-R- 7^-67^ (August 19 7 1 *) . [9] Khinchine, A. Ya., "Continued Fractions," Mo scow- Leningrad State Publishing House, 19^-9. [10] Khovanskii, A. N., "The Application of Continued Fractions," P. Nordhoff N. V. - Groningen - The Netherlands, 1963. BIBLIOGRAPHIC DATA SHEET 1. Report No. UIUCDCS-R- 75-693 2. 3. Recipient's Accession No. . '; 11 \c and Subtitle On a Negative Result Regarding the Use of Continued 5- Report Date January 1975 Fractions for Digital Computer Arithmetic 6. . Author(s) Kishor Shridharbhai Trivedi 8- Performing Organization Rept. No. . Performing Organization Name and Address Department of Computer Science 10. Project/Task/Work Unit No. University of Illinois Urbana, Illinois 6l801 11. Contract/Grant No. GJ 382 Ok 2. Sponsoring Organization Name and Address National Science Foundation 13. Type of Report & Period Covered Wa shi ngt on, D . C . 14. j-plcmi ritary Notes 6. Abstracts Some recent results demonstrate that representations of numbers other than positional notation may lead to practical hardware realizations for digital calculation of functions. This paper describes current research in the use of continued fractions. We establish the conditions for completeness of number systems using continued fractions. We propose an algorithm to evaluate the logarithm and show that no practical selection procedure exists for this algorithm. 7. Key Words and Document Analysis. 17o. Descriptors Completeness Computer Arithmetic Continued Fractions Hardware Logarithm Number System Redundancy Selection Procedure 7b. Identifiers 'Open-Ended Terms 7c. > OSAT1 F'ie Id/Group 8- '• tail .ibility Statement 19. Security Class (This Report) UNCLASSIFIED 21- No. of Pages 20. Security Class (This Page UNCLASSIFIED 22. Price ORM NTIS-35 (10-70) USCOMM-DC 40329-P7I *' L* # en CO i • J» »«> JVJ*