Method and apparatus for high speed determination of jth roots and reciprocals of jth roots
This is a continuation of application Ser. No. 07/459,041, filed Dec. 29, 1989 and now abandoned. 
    
    
     BACKGROUND OF THE INVENTION 
     Initially numeric processors computed division and square root determination utilizing a remainder method. This method was inefficient in comparison with remainderless division and square root determination based upon the Newton-Raphson algorithm or simple cases of convergence algorithms. The Newton-Raphson algorithm is an additive convergence algorithm applied to divide and square root approximations. A unified method of developing convergence algorithms applicable to higher convergence rates has not heretofore been developed. 
     There is a need for formulation of convergence algorithms applicable to higher convergence rates so as to improve efficiency in mathematical computations of j th  roots. 
     SUMMARY OF THE INVENTION 
     This need for improved efficiency in mathematical computations of j th  roots, utilizing a convergence algorithm formulated so as to be applicable to a selected convergence rate, including higher order convergence rates, is substantially met by the present invention. A numeric processor (NP) is set forth that generates convergence polynomials relative to desired convergence rates such that reciprocal j th  roots of inputs may be more efficiently computed. 
     Underlying the concept of the present invention is the following rationale: recognizing that if, for a given input x, x*f j  =1, then f=x -1/j . If f is represented as a series of factors, for example f=f 1  *f 2  *f 3 , then x*(f 1  *f 2  *f 3 ) j  =1, and it follows that x*[(f 1 ) j  *(f 2 ) j  *(f 3 ) j  ]=1 and f 1  *f 2  *f 3  =x -1/j . Thus, driving x toward 1.0 may occur in multiple steps. In general, f is a function of x. 
     Responsive to input values for a desired j th  root and a desired convergence rate of a selected input value, a NP determines a reciprocal of an approximate such root, in one embodiment obtaining the approximate such root from a read-only memory device. After raising the reciprocal of the approximate root to the j th  power and multiplying same by the selected input value to obtain a near unity value, the NP determines a convergence factor relative to the following three values: the desired convergence rate, the desired j th  root, and the near unity value. The convergence factor is determined as an approximate solution f j  [m](x) of an error equation x*{f j  [m](x)} j  =1-Δ m , where x is a near unity value, j represents a desired j th  root, m is a desired convergence rate, f j  [m](x) is an m-1 th  order polynomial in terms of x that when raised to the j th  power and multiplied by x causes an error Δ to decrease by the m th  power, and Δ  is 1-x. 
     Determination of f j  [m](x) is as follows: 1-Δ is substituted for x in the error equation; f j  [m](x) is taken to be f j  [m](Δ), where f j  [m](Δ)=1+A 1  Δ 1  +A 2  Δ 2  +A 3  Δ 3  + . . . A m-1  Δ m-1 , having coefficients A 1  through and including A m-1  ; 0&lt;1-Δ&lt;2; {f j  [m](x)} j  is expanded and multiplied by (1-Δ) as indicated; all terms that contain Δ p  such that p&gt;m are eliminated, obtaining an equation with coefficients g 1  through g m  of the form 1+g 1  Δ 1  +g 2  Δ 2  +g 3  Δ 3  . . . +g m  Δ m  =1-kΔ m  ; the coefficients of terms Δ 1 , Δ 2 , Δ 3 , . . . , Δ m-1  are equated to zero, yielding solutions for the A 1  through A m-1  coefficients above; (1-x) is substituted for Δ to obtain the convergence factor f j  [m](x)=1+K 1  x+K 2  x 2  +K 3  x 3  . . . +K m-1  x m-1 , having coefficients K 1  through and including K m-1 , where the K 1  -K m-1  coefficients are functions of the A 1  -A m-1  coefficients. 
     The NP raises the convergence factor to the j th  power and multiplies by x to obtain a new value for x. The NP multiplies the approximate reciprocal j th  root of the selected input by the convergence factor, determining a new approximation of an approximate reciprocal j th  root. The steps of determining a convergence factor through and including determining a new approximation of a reciprocal j th  root of a selected input are iterated until a solution with a desired degree of accuracy is obtained. The repeated iterations drive x toward 1 and the product of the convergence factors toward the reciprocal j th  root, i.e., x*{f i  [m](x)} j  →1 and π{f j  [m](x)}→1/(j th  root of x). 
     It will be obvious to one skilled in the art that the approximate j th  root of the selected input may be obtained readily from the approximate reciprocal j th  root, for example, utilizing S 1/j  =(S -1/j ) j-1  *S or (S -1/j ) -1 . 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a general flow chart of an implementation of the invention incorporating an application of an approximation strategy. 
     FIG. 2 is a block diagram of a computer hardware implementation of the invention. 
    
    
     BEST MODE FOR CARRYING OUT THE INVENTION 
     FIG. 1, generally depicted by the numeral 100, illustrates one embodiment of steps executed by a numeric processor (NP) incorporating the present invention. An error equation is expanded and solved through strategic elimination of selective terms, together with assignment of a zero value to appropriate coefficients, providing a convergence factor that is implemented iterably to determine a reciprocal of a desired root of an input value until a solution with a desired degree of accuracy is obtained. 
     The NP, utilizing at least one electrical signal, provides an input value of S, an input value m reflecting a desired convergence rate, and an input value j reflecting a desired j th  root (102). The NP utilizes at least one electrical signal to determine if S=±∞, ±0, or Not-a-Number (NaN) (104). If S=±∞, ±0, or NaN, NP utilizes an error check device (106), and stops processing. It is apparent that the order of input data may be varied, it only being necessary that the S value be input prior to the NP&#39;s check on whether S=±∞, ±0, or NaN. If S is other than ±∞, ±0, or NaN, the NP utilizes at least one electrical signal to determine a value b such that b is an approximation to the reciprocal of the j th  root of S (108). Then the NP employs at least one electrical signal to determine b to the j th  power (110). Next, the NP utilizes at least one electrical signal to determine a value of x such that x=S*b j , wherein 0&lt;x&lt;2, x being substantially close to 1.0 (112). 
     The NP then employs at least one electrical signal to manipulate an error equation, x*{f j  [m](x)} j  =1-Δ m , wherein f j  [m](x)=1+A 1  x+A 2  x 2  +A 3  x 3  . . . +A m-1  x m-1 , having coefficients A 1  through and including A m-1 , and Δ=1-x, Δ being error, and achieve a value for f j  [m](x), thereafter referred to as d, in the following manner: f j  [m](x) is an m-1 th  polynomial in Δ that is expanded by being raised to the j th  power and multiplied by (1-Δ) as indicated to obtain an equation of the form 1+g 1  Δ 1  +g 2  Δ 2  +g 3  Δ 3  . . . +g m  Δ m  =1-kΔ m , having coefficients g 1  through and including g m  ; the coefficients g.sub. 1 through and including g m-1  are equated to zero and all terms that contain Δ p  such that p&gt;m are eliminated such that solutions for A 1  through and including A m-1  are obtained; (1-x) is substituted for Δ to obtain an equation of the form f j  [m](x)=1+K 1  x+K 2  x 2  +K 3  x 3  . . . +K m-1  x m-1 , having coefficients K 1  through and including K m-1  such that the K 1  -K m-1  coefficients are functions of the A 1  -A m-1  coefficients, that is referred to as d and is utilized as a convergence factor (114). The NP employs at least one electrical signal to raise d to the j th  power (116), then to determine a new x such that x=x*d j   (118). Next the NP utilizes at least one electrical signal to determine a new b such that b=b*d (120) and such that b appears as an electrical output signal. 
     The steps of the immediately preceding paragraph are iterated until a solution with a desired degree of accuracy is obtained (122), at which time the NP stops. The degree of accuracy may be determined by how close x is to 1.0, or equivalently, how close Δ is to zero. 
     When j is unknown or fixed, then {f j  [m](x)} j  may be expanded using the binomial theorem, utilizing only the first m terms of a series generated by that theorem. 
     For example, for quadratic convergent reciprocal square root, wherein m=2 and j=2, the following steps derive f 2  [2](x) according to the present invention: 
     1. The error equation is 
     
         (1-Δ){f.sub.j [m](Δ)}.sup.j ≈1-Δ.sup.m 
    
     
         (1 -Δ){f.sub.2 [2](Δ)}.sup.2 ≈1-Δ.sup.2 
    
     
         (1-Δ)(1+A.sub.1 Δ).sup.2 ≈1-Δ.sup.2 
    
     2. Expand the error equation eliminating terms containing Δ p  such that p&gt;2, obtaining Δ p  terms with coefficients related to the A coefficients: 
     
         (1-Δ)(1+2A.sub.1 Δ+Δ.sup.2)≈1-Δ.sup.2 
    
     
         1+Δ(2A.sub.1 -1)+Δ.sup.2 (1-2A.sub.1)≈1-Δ.sup.2 
    
     3. Set the coefficient of the Δ term to zero, and solve for A 1  : 
     
         2A.sub.1 -1=0 
    
     
         A.sub.1 =1/2 
    
     4. Substitute the value obtained for A 1  into f 2  [2](Δ)=1+A 1  Δ, and relate solution to x: 
     
         f.sub.2 [2](Δ)=1+(1/2)Δ 
    
     
         Since x=1-Δ, f.sub.2 [2](x)=1.5-0.5x 
    
     The algorithm for the reciprocal square root is then: 
     For an input of magnitude S, ##EQU1## 
     The method of the invention, being the first such method known to the inventor to construct a general approach applicable even to solution of higher order roots, is designated &#34;Lindsley&#39;s Law.&#34; 
     It will be apparent to those skilled in the art that the reciprocal of the j th  root of an input may be utilized to obtain the j th  root of that input. 
     Additionally, it will be apparent to those skilled in the art that if j and m are selected as constants, the polynomial f j  [m](x) will be dictated by j and m, and may be determined at a suitable time. The method of the invention may then proceed to utilize the determined polynomial as necessary without redetermination during the implementation of the preselected j and m constants. 
     Further, it will be apparent that error(Δ) decreases by the square for each iteration in quadratic convergence where m=2, by the cube for each iteration in cubic convergence where m=3, and so on in this related manner. 
     In an implementation of the present invention in which convergent reciprocal such that j=1 is desired, an application useful for division algorithms in addition to other uses, it is apparent that non-zero terms of f j  [m](x) are approximated to give 
     
         d=f.sub.j [m](x)=1+(1/j)[(1-x).sup.1 +(1 -x).sup.3 . . . +(1-x).sup.m-1 ], 
    
     with j=1, that may be simplified to: ##EQU2## for different selected convergence rates. 
     In another implementation of the present invention in which convergent reciprocal square root such that j=2 is desired, an application useful for square root algorithms in addition to other uses, it is apparent that non-zero terms of f j  [m](x) are approximated to give ##EQU3## with j=2, which may be simplified to: ##EQU4## for different selected convergence rates. 
     It will apparent to one skilled in the art that in a similar manner to that described above, this invention may be implemented by selecting a fixed convergence rate m, and utilizing different selected values for j. 
     In an implementation for quadratic convergence rate, wherein m=2, f j  [2](Δ)=1+Δ/j, or equivalently, f j  [m](x)=(j+1-x)/j, yielding the following quadratic convergence functions for various reciprocal roots: 
     
         f.sub.1 [2](x)=2-x 
    
     
         f.sub.2 [2](x)=1.5-0.5x 
    
     
         f.sub.3 [2](x)=(4/3)-(1/3)x 
    
     In an implementation for cubic convergence rates, wherein m=3, f j  [3](Δ)=1+(Δ/j)+Δ 2  [1-(j-1)/(2j)]/j, or equivalently, f j  [3](x)=(2j 2  +3j+1)/(2j) 2  -x(2j+1)/j 2  +x 2  (j+1)/(2j 2 ), yielding the following cubic convergence functions for various reciprocal j th  roots: 
     
         f.sub.1 [3](x)=3-3x+x.sup.2 
    
     
         f.sub.2 [3](x)=1.875-1.25x+0.375x.sup.2 
    
     
         f.sub.3 [3](x)=(14/9)-(7/9)x+(2/9)x.sup.2 
    
     FIG. 2, generally depicted by the numeral 200, illustrates a hardware implementation of the present invention. A computer program for implementation of the present invention may be stored in the program memory (204), other memory (212), may be embodied in hardware in the ALU (206), or may be any combination utilizing at least two of the following: program memory, other memory, and hardware in the ALU (204, 212, 206). In one embodiment, the program control unit (202), typically including at least a second selecting unit and a third selecting unit as is clear from the method described above, utilizes the bus (210) to select a program to implement the present invention, and the status register (208) determines whether the selected input value is ±∞, ±0, or NaN, the program control unit (202) and the status register (208) typically providing at least a first selecting unit as is clear from the method described above. 
     If the selected input value is other than ±∞, ±0, or NaN, the ALU (206), including a first determining unit having a read-only-memory (ROM) unit, performs the previously described manipulations of values in application of the determination of an electrical output value for a reciprocal of a desired j th  root of an input value, based on an electrical input value reflecting a desired convergence rate and an electrical input value reflecting a magnitude for a desired j th  root. It will again be apparent to one skilled in the art that an electrical output value for an approximation of a j th  root of a selected input may be attained by obtaining a reciprocal of the reciprocal of the approximation of the j th  root of the selected input. 
     In one embodiment, to determine an initial approximation of a reciprocal of a j th  root of a selected input, the first determining unit generates an estimate of same that is stored in 8 bits of binary memory. 
     In another embodiment, an approximation of that reciprocal may be determined from a table of values that is stored in program memory (204) or other memory (212) such as a ROM of the first determining unit. 
     In one embodiment the method of the invention allocates data storage and manipulation devices such that the method is executed as described above.