Abstract:
Apparatus for decreasing the latency time associated with floating point addition and subtraction in a computer, using a novel bifurcated, pre-normalization/post-normalization approach that distinguishes between differences of floating point exponents.

Description:
The Government of the United States of America has rights in this invention pursuant to Department of Energy Contract W-7405-ENG-48 between the U.S. Department of Energy and the University of California for the operation of Lawrence Livermore National Laboratory. 
    
    
     FIELD OF THE INVENTION 
     The invention pertains to high speed digital computers, and more particularly to methods and apparatus for performing floating point operations in digital computers. 
     BACKGROUND OF THE INVENTION 
     High speed computing normally requires many-fold repetitive arithmetic operations (addition, subtraction, multiplication, division, exponentiation, etc.). An increase in efficiency of one or more of such operations translates directly into proportionate time savings in computer operation. In floating point operations, whereby any numerical operand x (≠ 0) is represented by a unique ordered pair of numbers (e, f) such that e is an integer and f satisfies 1 ≦ |f| &lt; 2 so that x=2 e  f, paradoxically, the addition and subtraction operations are more cumbersome than the operations of multiplication, division and exponentiation. Thus, efficiency improvements in floating point addition and subtraction are of special interest. 
     Bohm, in U.S. Pat. No. 3,315,069, discloses and claims a computer that is constructed to always form the quantity F(a, b, c, d)=(a±b)×c÷d in response to any binary arithmetic input (a, b) or (a, c) or (a, d) or (b, c) or (b, d) or (c, d); with the other two arithmetic inputs being chosen to produce the particular arithmetic result desired. For example, if the difference a-b is desired, the function F and its four inputs become F(a, -b, 1, 1)=(a-b)×1=a-b; and if the quotient a÷d (d≠0) is called for, the function F and its inputs becomes F(a, 0, 1, d)=a/d. Groups of four registers, one containing each of the inputs a, (±)b, c and d, are logically connected so that the result F(a, b, c, d)=(a±b)×c/d is always produced. The inventor notes that time for addition or subtraction in this scheme is substantially longer than addition or subtraction in a conventional approach. And use of floating point numbers would pose further problems and require additional computer time. 
     Kindell et al disclose and claim computer apparatus for consistently &#34;rounding off&#34; positive and negative numbers in 2&#39;s complement representations of floating point numbers, in U.S. Pat. No. 3,699,326. A rounding constant, different for positive and for negative numbers, is added to such numbers for purposes of storage or comparison. The logic used causes consistent round up (round down) to an n-bit number if the actual, untruncated number minus the n-bit truncated number lies closest to or equidistant between the &#34;upper&#34; (&#34;lower&#34;) of two adjacent values of the number truncated at the n th  bit. No means of forming sums or differences of two floating point numbers is discussed. 
     Method and apparatus for approximately simultaneous computer computation and processing of coefficients for two Fast Fourier Transform algorithms is disclosed and claimed in U.S. Pat. No. 3,721,812, issued to Schmidt. In one embodiment, the Schmidt invention interlaces two serial streams of appropriate data in a single serial access memory so that two Fast Fourier Transforms may be calculated substantially simultaneously, thus reducing the time normally required for computation of the FFT by approximately 50 percent. However, the invention does not concern simultaneous performance of additions and subtractions of floating point representations of numbers. 
     SUMMARY OF THE INVENTION 
     The subject invention is method and apparatus for performing floating point arithmetic operations such as addition and subtraction of two floating point (binary) numbers x A  =(2 e .sbsp.A)f A  and x B  =(2 e .sbsp.B)f B  (1 ≦ f A , f B  &lt; 2, e A  and e B  integers), on a computer in a time-efficient manner. 
     One object is to provide an approach for floating point addition and subtraction that consumes less computer time relative to prior art approaches. 
     Another object is to provide an approach for performing floating point addition and subtraction simultaneously. 
     Other objects of the invention, and advantages thereof, will become clear by reference to the detailed description and the accompanying drawings. 
     To achieve the foregoing objects in accordance with the invention, the conventional three step process of prenormalization, addition, and postnormalization for performing a floating point arithmetic operation is broken up into two parallel two step processes, each two step process essentially eliminating one of the steps of the three step process. The two paths provide the correct answer for the two cases where the exponents are close (exponent difference ≦ 1) or far apart (&gt; 1), respectively. A floating point arithmetic operation is performed simultaneously in both paths, without regard to which condition is actually true, and the correct answer is selected from the results by means of a simple test of three bits of the answer. In the case where the exponents are close (difference ≦ 1), the prealignment step is eliminated since one of the numbers must at most be shifted one bit; the unshifted or one-bit shifted number is selected by means of a multiplexer using a simple test of the lower two bits of the exponents to provide the select signal. In the case where the exponents are far apart (difference &gt; 1 ), the post-normalization step is eliminated since once the numbers have been prealigned and added, the result requires at most a one-bit right or left shift, which can be selected by means of a multiplexer using a simple comparison of three bits of the result to provide the appropriate select signal. 
     In one preferred embodiment, the first path is implemented by a (short) alignment shift calculator which compares each lower two bits of the exponent and forms the control signals r A  =max (0, e B  -e A ), r B  =max (e A  -e B , 0) which in this case are either 0 or 1. The outputs of a pair of two input multiplexers with inputs f A , 1/2 f A  and f B , 1/2 f B , respectively, are controlled by the select signals r A  and r B , respectively, to provide the appropriate inputs (either unshifted or shifted by one bit) into an adder/subtracter to form the sum f tmp  =f A  2 -r .sbsp.A +f B  2 -r .sbsp.B. The sum f tmp  is input into a priority encoder which generates the function S=|log 2  |f tmp  |. A shifter produces the result f&#39; r  =f tmp  2 -S  by shifting f tmp  by S bits, and an adder produces the result e r  &#39;=e max  +S. 
     The second path is implemented by a (full) alignment shift calculator which looks at the entire exponents and forms the control signals r A  and r B  (which may be &gt;1 in this case). The control signals r A  and r B  are input to a pair of barrel shifters which shift f A  and f B , respectively, for proper prealignment to provide the appropriate input to an adder/subtacter which forms the sum f tmp  =f A  2 -r .sbsp.A +f B  2 -r .sbsp.B. By checking three bits of f tmp , the two bits before the point f tmp  (1) and f tmp  (0) and the bit after the point f tmp  (-1), for the presence of a 1, one of three answers can be selected from a four-input multiplexer 1/2 f tmp , f tmp , or 2 f tmp . If none of the bit tests are satisfied (none of the three test bits is a 1) then this indicates that the second path does not provide the correct answer and the first path result, which is the fourth input to the multiplexer, is the correct answer. The bit test also allows the selection of the correct exponent, e max  +1, e max  or e max  -1, formed using adders, if one of the bit tests is satisfied, or the result from the first path if none of the bit tests are satisfied, with the four choices being inputs to a four-input multiplexer. 
     To perform simultaneous add and subtract in the first path, an exclusive or gate can be added to compare the sign bits of f A  and f B  and to select the signed inputs, either unshifted or one-bit shifted, from a four-input multiplexer. In the second path, a subtractor circuit is placed in parallel to the adder. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The accompanying drawings, which are incorporated in and form a part of the specification, illustrate an embodiment of the invention and, together with the description, serve to explain the principles of the invention. 
     FIG. 1 is a schematic view of representative prior art apparatus for performing floating point addition. 
     FIGS. 2 and 3 are schematic views of complementary apparatus, used in combination for performing floating point addition (or subtraction) according to the subject invention. 
     FIGS. 4 and 5 are schematic views of complementary apparatus, used in combination in simultaneously performing floating point addition and floating point subtraction according to the subject invention with significantly less than twice the hardware required to do either operation individually. 
    
    
     DETAILED DESCRIPTION 
     The invention provides method and apparatus for improved floating point arithmetic operation. In the prior art, floating point addition/subtraction is basically a three step process of alignment, addition and realignment. The invention shortens the conventional process by essentially eliminating the first or third step. According to the invention the numbers are first compared to determine if the exponents are greatly different or close together. The two cases are processed differently. Depending on the result of the comparison, one of two two-step processes is selected. The operations are performed simultaneously in two parallel independent paths, and the correct answer is selected according to the appropriate criteria from the answers produced in the two paths. If there is a large exponent difference the necessity for the realignment step is eliminated, and the process is essentially that of alignment and addition. If the exponents are close together, then the step of alignment is eliminated and the appropriate process is one of addition and realignment. Thus, by performing an initial comparison, one of the three full steps can be replaced by a much shorter operation which thereby reduces overall process time. This is accomplished by parallel hardware which produces two different answers only one of which is correct, for the two cases, the correct answer being selected by a simple test. The invention can be utilized to perform the operations A+B and A-B in pairs, one through the first two-step process and the other through the second two-step process, the two operations being performed independently in parallel. 
     This invention decreases the &#34;latency&#34; of certain floating point operations such as addition and subtraction for purposes of high speed computing. The &#34;latency&#34; of an operation is the time elapsed, beginning when an operation is first begun and ending when the immediately following operation that is dependent upon the first operation, is begun. A computer arithmetic operation may have many latencies, one for each possible way in which other operations can depend upon the subject operation. In high speed &#34;number crunching&#34; computer operations, latency is of critical importance, whether or not the machine is rapidly performing a repetitious sequence of arithmetic/logical operations through &#34;pipelining&#34;. Thus, design of computer hardware for floating point addition/subtraction with minimal latency and high pipeline rate is very attractive. 
     A floating point number x is expressed as a pair of numbers (e, f), where the mantissa or fraction f (expressed in binary form) is a p-bit fixed point fraction whose magnitude lies between 1 and 2, 
     
         1≦|f|&lt;2 (except for x=0), 
    
     and the exponent e, is an integer, with the floating point number x being representable uniquely as x=2 e  f. Given two floating point numbers, x A  =(e A , f A ) and x B  =(e B , f B ), a conventional approach to compute the normalized floating point sum illustrated schematically with reference to FIG. 1, first determines e max  =max(e A , e B ) and shifts both x A  and x B  downward by e max  binary places using a full alignment shift calculator and a pair of right shifts to form f A  2 e .sbsp.A -e .sbsp.max and f B  2 e .sbsp.B -e .sbsp.max ; this assures that the exponents are both non-positive. The two modified numbers to form the sum are added in an adder/subtractor 
     
         f.sub.tmp =f.sub.A 2.sup.e.sbsp.A.sup.-e.sbsp.max +f.sub.B 2.sup.e.sbsp.B.sup.-e.sbsp.max 
    
     and the functions 
     
         g.sub.tmp =log.sub.2 |f.sub.tmp |, and 
    
     
         S= g.sub.tmp  , 
    
     where  g  is the largest integer ≦ the real number g are formed by means of a priority encoder which counts leading zeros. The numbers f tmp  and g tmp  satisfy the condition 
     
         |f.sub.tmp |&lt;4, 
    
     
         -∞&lt;g.sub.tmp &lt;2. 
    
     The result of the floating point operation is obtained by means of an adder and a full shift of S bits: 
     
         e.sub.r =e.sub.max +S, 
    
     
         f.sub.r =2.sup.-S f.sub.tmp, 
    
     where (e r , f r ) is the pair of numbers representing the desired floating point sum. Two potentially large shifts must be performed serially in the conventional approach; the first shift initially aligns the operands; and the second shift renormalizes the result of the addition/subtraction operation. These full shifts, performed serially, represent a large fraction of the total latency (elapsed time) of conventional floating point addition and subtraction. 
     The subject invention provides a new approach, utilizing the fact that computation of the floating point sum (or difference) x A  +x B  =f A  2 e .sbsp.A +f B  2 e .sbsp.B can be resolved into two mutually exclusive and exhaustive situations, each with a separate approach and corresponding hardware, and each being performable faster than by use of the conventional approach. The difference |e A  -e B  | is formed in an exponent comparator (not shown). Two independent parallel computations are performed, as shown schematically in FIGS. 2 and 3, respectively, one for each of the two possible situations, and the correct answer is selected by examining the two results. 
     Situation 1: |e A  -e B  =0 or 1. The right shift operation, used to implement the usual division by 2.sup.|e.sbsp.A -e .sbsp.B|, is either no shift or a one-place right shift for numbers in binary form; and the shift itself can be determined by looking solely at the lowest two bits of each exponent e A  and e B . Only the lowest two bits are checked in the FIG. 2 path, and the calculation is performed as if the exponent difference is less than or equal to 1. The FIG. 2 path has been optimized for this case in terms of minimizing latency of operation. Of course, the test may not be true depending on the higher bits of the exponents. The correctness of the answer is determined by checking the result, as discussed below; it may turn out that the FIG. 3 answer is the correct result, in which case the FIG. 2 answer is rejected. 
     Formation of the sum (or difference) in this situation may be implemented using the apparatus of FIG. 2 as follows. 
     
         Set e.sub.max =max(e.sub.A, e.sub.B); 
    
     
         if e.sub.A =e.sub.B +1, set r.sub.A =0 and r.sub.B =1; 
    
     
         if e.sub.A =e.sub.B, set r.sub.A =r.sub.B =0; 
    
     
         if e.sub.A =e.sub.B -1, set r.sub.A =1 and r.sub.B =0; 
    
     or more generically, 
     
         set r.sub.A =max(e.sub.B -e.sub.A, 0)=e.sub.max -e.sub.A and 
    
     
         r.sub.B =max(e.sub.A -e.sub.B 0)=e.sub.max -e.sub.B. 
    
     The values of r A  and r B  can only be 0 or 1 (in this case). If |e A  -e B  |&lt;1, one need only compare the lowest two bits of each exponent to determine e max , r A  and r B , which is considerably faster than comparing all bits of e A  and e B . The apparatus then forms the following functions and results: 
     
         f.sub.tmp =f.sub.A 2.sup.-r.sbsp.A +f.sub.B 2.sup.-r.sbsp.B, 
    
     
         S= log.sub.2 |f.sub.tmp | , 
    
     
         e&#39;.sub.r =e.sub.max +S, 
    
     
         f&#39;.sub.r =2.sup.-S f.sub.tmp. 
    
     In this situation, the time required to determine e max , r A  and r B  is small as only two bits of e A  and e B  need be compared. 
     With reference to FIG. 2, the integers e A  and e B  are input to a short alignment/shift calculator 11 which generates e max  =max(e A , e B ), which is input to a final adder 23 as shown, and also generates two numerical signals r A  =max (e B  -e A , 0) e max  -e A  and r B  =max (e A  -e B  0)=e max  -e B  that are input, respectively, as select signals to a pair of two input multiplexers 13 and 15. The multiplexer 13 receives input quantities f A  and f A  /2, e.g., by wiring the appropriate bits of f A  to the inputs of multiplexer 13, and, produces a single output, 
     
         f.sub.A (if r.sub.A =0), 
    
     or 
     
         f.sub.A /2 (if r.sub.A =1); 
    
     but no time consuming calculations need be performed by multiplexer 13. Similarly, the multiplexer 15 receives the input quantities f B  and f B  /2 and produces a single output, 
     
         f.sub.B (if r.sub.B =0), 
    
     or 
     
         f.sub.B /2 (if r.sub.B =1). 
    
     The numerical signals f A  2 -r .sbsp.A and f B  2 -r .sbsp.B (outputs from the multiplexer 13 and 15, respectively) are now both input to an intermediate adder/subtracter 17 that forms and outputs the sum; and this output is input to priority encoder 19 that forms and outputs the numerical quantity  log 2  |f|  for any (real, positive) numerical input f. The output S= log 2  |f A  2 -r .sbsp.A +f B  2 -r .sbsp.B |  of the priority encoder 19 and the output e max  of the calculator 11 are both input to the final adder 23 that forms the sum e&#39; r  =e max  +S. The output f tmp  =f A  2 -r .sbsp.A +f B  2 -r .sbsp.B of the intermediate adder and output S of the priority encoder 19 are both input to a shifter 21 that forms and outputs the numerical quantity f r  2 -S  f&#39; tmp . Since S is an integer, multiplication of f tmp  by 2 -S  is accomplished by merely right shifting f tmp  by S places. Note that only one full shift operation is required in this situation, the postnormalization shift, by S bits, since the prealignment shift was eliminated. The prealignment operation was performed simply by comparing the two lowest bits of the exponents to determine the appropriate select signals to a pair of multiplexers which select either the unshifted number or the number right-shifted one bit. 
     Situation 2: |e A  -e B  |≧2. Here, division by 2.sup.|e.sbsp.A -e .sbsp.B.sup.|  requires an arbitrarily large right shift (by two or more places) for pre-alignment; but postnormalization alignment will require at most a one place shift. To verify this, for the case where e A  -e B  ≧2, then 
     
         |f.sub.A +f.sub.B 2.sup.-(e.sbsp.A.sup.-e.sbsp.B.sup.) |≧|f.sub.A |-|f.sub.B |2.sup.-(e.sbsp.A.sup.-e.sbsp.B.sup.) ≧1-2.sup.1-(e.sbsp.A.sup.-e.sbsp.B.sup.) ≧1-1/2=1/2, 
    
     
         |f.sub.A +f.sub.B 2.sup.-(e.sbsp.A.sup.-e.sbsp.B.sup.) |≦f.sub.A +f.sub.B 2.sup.-(e.sbsp.A.sup.-e.sbsp.B.sup.) ≦2+2.sup.1-(e.sbsp.A.sup.-e.sbsp.B.sup.) ≦5/2. 
    
     Thus, the result of addition (or subtraction) of x A  and x B  can never be so large or so small as to require more than a one place right or left shift to renormalize the sum x A  +x B . Formation of the sum (or difference) in this situation may be implemented as follows, as illustrated in FIG. 3. 
     
         Set e.sub.max =max (e.sub.A, e.sub.B); 
    
     calculate 
     
         r.sub.A =max (e.sub.B -e.sub.A, 0)=e.sub.max -e.sub.A 
    
     
         and r.sub.B =max (0, e.sub.A -e.sub.B)=e.sub.max -e.sub.B 
    
     
         f.sub.tmp =f.sub.A 2.sup.-r.sbsp.A +f.sub.B 2.sup.-r.sbsp.B ; 
    
     
         if |f.sub.tmp |≧2, set f.sub.r =1/2 f.sub.tmp and e.sub.r =e.sub.max +1;                                    (1a) 
    
     
         if 1≦|f.sub.tmp |≦2, set f.sub.r =f.sub.tmp and e.sub.r =e.sub.max ;                                  (1b) 
    
     
         if 1/2≦|f.sub.tmp |&lt;1, set f.sub.r =2 f.sub.tmp and e.sub.r =e.sub.max -1;                                (1c) 
    
     The formation of f r , knowing the magnitude of f tmp  (1/2≦|f tmp  |≦5/2), requires at most a right or left shift of f tmp  by one place plus a (simultaneous) addition or subtraction of zero or one from e max  for the resultant exponent e r . 
     These operations are implemented by the apparatus of FIG. 3. The integers e A  and e B  are input to a (full) alignment calculator 31 which generates e max , r A  and r B . The output e max  is input to exponent increment means 43 that forms and outputs three signals, e max  +1, e max  and e max  -1, and feeds these three signals to a multiplexer 45. 
     The short alignment shift calculator 11 of FIG. 2 and the full alignment shift calculator 31 of FIG. 3 may, of course, be combined into a single unit as they receive the same inputs, perform precisely the same operations, and output the same variables; but the invention will form the sum or difference of x A  and x B  more quickly for |e A  -e B  |≦1 if a separate short alignment/shift calculator is used since the shift operation in this instance only requires examination of the two lowest order bits of e A  and e B . 
     The signals r A  and r B  from shift calculator 31 are input, respectively, as control signals to two right shift means (barrel shifters) 33 and 35. The shift means 33 and 35 also receive, respectively, the inputs f A  and f B  and form the respective outputs f A  2 -r .sbsp.A and f B  2 -r .sbsp.B, by performing right shift of f A  and f B  by r A  and r B  places, respectively. The outputs of the right shift means 33 and 35 are input to an intermediate adder/substracter 37 that forms and outputs the sum f tmp  =f A  2 -r .sbsp.A +f B  2 -r .sbsp.B. The three signals 1/2 f tmp , f tmp  and 2 f tmp  are input, e.g., by wiring the appropriate bits to the input, to a multiple input magnitude comparator/multiplexer 41 that determines which of the three inequalities in Equations (1a, b, c) is true. If inequality (1a) is satisfied, the comparator 41 outputs f r  =1/2 f.sub. tmp and sends a positive latch signal LS3 to the multiplexer 45, which then outputs e r  =e max  +1. If inequality (1b) is satisfied, the comparator 41 outputs f r  =f tmp  and sends a positive latch signal LS4 to the multiplexer 45, which then outputs e r  =e max . If inequality (1c) is satisfied, the comparator 41 outputs f r  =2 f tmp  and sends a positive latch signal LS5 to the multiplexer 45, which then outputs e r  =e max  -1. If none of the conditions are satisfied (i.e., |f tmp  |&lt;1/2), then set f r  =f r  &#39; and e r  =e&#39; r  from FIG. 2. 
     Thus, the correct output from the FIG. 3 path is determined by testing the magnitude of f tmp  in comparator 41 and outputing the appropriate result f r  =1/2 f tmp , f tmp  or 2f tmp . This process also selects the correct exponent from multiplexer 45. However, all three of the tests 1a, b, c may fail since the initial premise that |e A  -e B  |≧2 may not have been correct; in this case the correct answer was provided by the circuitry of FIG. 2, i.e., |e A  -e B  |=0 or 1. Accordingly, the result f&#39; r  from FIG. 2 is the fourth input to comparator 41 and is output if the three magnitude tests fail; also the result e&#39; r  for FIG. 2 is the fourth input to multiplexer 45 and is output, by applying latch signal LS6, when the final magnitude tests fail. The overall process time has been decreased by performing the simultaneous calculations of FIGS. 2 and 3 as if each case is true and then performing a simple comparison at the end to select the correct answer. 
     FIGS. 4 and 5 illustrate a second embodiment of the invention, useful for simultaneously generating the sum and difference of two numbers, x A  ±x B  =f A  2 e .sbsp.A ±f B  2 e .sbsp.B with only a modest increase in apparatus compared with apparatus for the generation of sums of numbers exhibited in FIGS. 2 and 3. In the embodiments illustrated in FIGS. 2 and 3, subtraction was performed essentially the same as addition, using complementary numbers (2&#39;s complement form), with the same apparatus. As shown in FIG. 4, for the case where |e A  -e B  |&lt;2, a short alignment shift calculator 11 is used to determine the control signals r A  and r B  as was previously described. The signal r A  is used as the select signal for a two input multiplexer 13 having inputs f A  and 1/2 f A  ; thus, the quantity f A  is shifted at most one bit. The output from multiplexer 13 is input to adder/subtractor 17. The signal r B  is applied as one select signal to four input multiplexer 16 having inputs f B , 1/2 f B , -f B , -1/2 f B  where the negative members are in 2&#39;s complement form. Force opposite sign means 18, which is an exclusive OR gate, generates an output signal LS9 from two inputs which are the sign bits of f A  and f B . The signal LS9 is applied as a second select signal to multiplexer 16 and is used to select the positive or negative output while signal r B  is used to select the unshifted or single bit shifted output. The output from multiplexer 16 is also input to adder/subtractor 17. Thus, the output from gate 18 determines if the two numbers are added or subtracted. The multiplexer 16 outputs ±f B  2 -r .sbsp.B, according to sign latch LS9 and signal r B  ; and this output together with output f A  2 -r .sbsp.A from the multiplexer 13 are input to an adder/subtractor 17. For the situation |e A  -e B  |≦1, the remainder of the components of FIG. 4 are the same as in FIG. 2 to produce the resultant e&#39; r .sup.(±) =e max  +S.sup.(±) and f&#39; r .sup.(±) =2 -S .spsp.(±) f.sup.(±) tmp  for this situation, where 
     
         S.sup.(±) = log.sub.2 |f.sub.A 2.sup.-r.sbsp.A ±f.sub.b 2.sup.-r.sbsp.B |  and f.sup.(±).sub.tmp =f.sub.A 2.sup.-r.sbsp.A ±f.sub.B 2.sup.-r.sbsp.B. 
    
     The independent parallel computation for the case |e A  -e B  |≧2 is illustrated with reference to FIG. 5, where adder/subtractor 37 of FIG. 3 is replaced by separate adder 36 and subtractor 38 that receive the signals f A  2 -r .sbsp.A and f B  2 -r .sbsp.B from shift means 33 and 35. Adder 36 forms the sum f A  2 -r .sbsp.A +f B  2 -r .sbsp.B =f.sup.(±) tmp  and subtractor 38 forms the difference f A  2 -r .sbsp.A -f B  2 -r .sbsp.B =f.sup.(-) tmp . The remainder of the components of FIG. 5 function as in FIG. 3 to produce the resultant e r  =e max  +{S, 1, 0 or -1} and f r .sup.(±) ={2 -S , 0.5, 1.0 or 2.0}×f.sup.(±) tmp  for the situation |e A  -e B  |≧2 or ≧2 with hardware duplicated on the sum and difference paths. The output from adder 36 is input either unshifted or shifted one bit to the left or right to the inputs of magnitude comparator/multiplexer 41; the result f&#39; r  from FIG. 4 is applied to the fourth input. The signal e max  for calculator 31 is input to exponent increment means 43 which provides three inputs e max , e max  +1, e max  -1 to exponent multiplexers 45 and 45A. The output from subtractor 38 is input either unshifted or shifted one bit to the left or right to three inputs of magnitude comparator/ multiplexer 41A with the result f&#39; r  from FIG. 4 applied as the fourth input. The comparators 41 and 41A select the proper output as previously described and provide latch signals LS3-6 to multiplexers 45 and 45A to select the proper exponent. Thus, the sum and difference of the two numbers are simultaneously obtained from components 41 and 45 and 41A and 45A. 
     The apparatus of FIGS. 4 and 5 is useful in generating sums or differences (x A  ±x B ) of floating point numbers serially with substantially the same hardware. To perform operations such as the Fast Fourier Transform, simultaneous generation of sums and differences is required. In this instance, the component apparatus of FIGS. 4 and 5 can still be used since sufficient dedicated hardware has been provided for forming the simultaneous sum and difference. 
     The cicuitry shown in the drawings, described in the specification, used in the reduction to practice, and found to operate successfully in accordance with the invention, are implemented in combination with a 64 bit supercomputer, which provides all the other elements necessary to form an operational digital computer, and which is described in S-1 Project FY 1979 Annual Report, University of California Lawrence Livermore National Laboratory, UCID-18619 (1979), which is incorporated herein by reference. The circuitry can be designed for any number of bits by utilizing the appropriate number of elements. The apparatus for floating point operation is used in combination with a conventional computer which provide all of the necessary functions to operate the floating point apparatus, e.g., forming 2&#39;s complements for subtraction operations, or rounding off. 
     A preferred embodiment of the invention has been constructed using the Fairchild F100K ECL family of logic components. The two-input multiplexers are F100155 Quad Multiplexer/Latch chips while the four-input multiplexers are F100171 Triple 4-Input Multiplexer with Enable chips. The adders are implemented using the F100180 High Speed 6-Bit Adder with the F100179 Carry Lookahead Generator. The priority encoder (count leading zeros) is the F100165 Universal Priority Encoder. The full shifter (barrel shifter) is implemented with the F100158 8-Bit Shift Matrix. These components are described in the Fairchild F100K ECL Data Book, which is herein incorporated by reference. 
     The preferred embodiments of the invention are implemented using conventional components. Computer structure is described in The Structure of Computers and Computations, Vol. I, by David J. Kuck, J. Wiley and Sons (1978); and Computer Arithmetic Principles, Architecture and Design, by Kai Hwang, J. Wiley and Sons (1979). Floating point arithmetic is described in Kuck, pages 210-216, and Hwang, Chapter 9, which are herein incorporated by reference. A general type of shift means is illustrated by the barrel shifter described in Kuck, pages 231-233. A floating point add unit is illustrated in Hwang, FIG. 9.17 on page 314. The functional means which produces the function S is a priority encoder, e.g., the zero digit check (ZDC) shown in FIG. 9.17. Equivalently, the functional means are implemented using one position counting as described in Kuck, pages 233-234. The preferred embodiments of the invention utilize conventional digital multiplexers, as described in Hwang, pages 33-36; likewise, comparators are conventional digital components, as illustrated in Hwang, pages 45-47 (FIGS. 2.12 and 2.13). 
     To summarize the basic principles and operations according to the invention an alignment shift calculator receives the integer exponent signals e A  and e B , forms the intermediate difference e A  -e B , and determines whether e A  -e B  is positive, negative or zero. If e A  -e B  &gt;0, the calculator sets e max  =max(e A , e B )=e A , r A  =max(0, e B  -e A )=0 and r B  =max(e A  -e B , 0)=e A  -e B . If e A  -e B  &lt;0, the calculator sets e max  =e B  and r A  =r B  =0. In a short alignment calculator, e A  -e B  =-1, 0 or +1 so that the integers e max , r A  and r B  may be quickly determined by testing only the two lowest bits. 
     A two input multiplexer receives the input signals f A , 1/2 f A  and select signal r A  and outputs a single signal f 0  =f A  (if r A  =0) and f 0  =1/2 f A  (if r A  =1), or f 0  =f A  2 -r .sbsp.A for either choice of r A , thus providing either an unshifted or one-bit shifted output. 
     Three mutually distinct alternatives are possible: 
     (1) r A  =1, r B  =0 and e B  -e A  =+1; 
     (2) r A  =0, r B  =1 and e A  -e B  =+1; 
     (3) r A  =r B  =0 and e A  =e B . 
     If the first alternative is present, x B  =2 e .sbsp.B f B  &gt;x A  =2 e .sbsp.A f A  and x A  +x B  =2 e .sbsp.B {f B  +2.sup.(e.sbsp.A -e .sbsp.B.sup.) f A  }=2 e .sbsp.B {f B  +1/2 f A  }; and if it is assumed for definiteness that f B  &gt;0 (1≦f B  &lt;2), then 0&lt;f B  +1/2 f A  &lt;3. 
     
         (0&lt;|f.sub.B +1/2 f.sub.A)|&lt;3, more generally.) 
    
     Similarly, if the second alternative is present and one assumes that f A  &gt;0 for definiteness (1≦f A  ≦2), 
     
         x.sub.A +x.sub.B =2.sup.e.sbsp.A {f.sub.A +1/2 f.sub.B } 
    
     
         0&lt;f.sub.A +1/2 f.sub.B &lt;3. 
    
     
         (0&lt;|f.sub.A +1/2 f.sub.B |&lt;3, more generally.) 
    
     If the third alternative is present, 
     
         x.sub.A +x.sub.B =2.sup.e.sbsp.A {f.sub.A +f.sub.B }, 
    
     
         -4&lt;f.sub.A +f.sub.B &lt;4, 
    
     
         0&lt;|f.sub.A +f.sub.B &lt;4. 
    
     In any event, the signal f tmp  =2 -r .sbsp.A f A  +2 -r .sbsp.B f B  is easily formed and satisfies 0&lt;|f tmp  |&lt;4. 
     The priority encoder receives the signal f tmp  and produces an output signal S= |log 2  |f tmp  | . If |f tmp  |=(h 2 , h 1 , h 0 , . . . , h -n+2 ) in binary representation, S is the highest integer p for which h p  =1; and -(n-2)≦S≦1. Alternatively, if no h p  =1 then f tmp  =0 and x A  +x B  =0. If f tmp  ≠0, f r  =2 -S  f tmp  satisfies 1≦f r  ≦2. Thus, x A  +x B  =2 e .sbsp.max f tmp  = 2 e .sbsp.max + .sbsp.S f r  which displays the floating point decomposition of the sum X A  +x B  when |e A  -e B  |≦1. 
     If |e A  -e B  |≦2, one again utilizes right shift means and left shift means, an adder, an exponent increment means to produce the integer signals e max  +1 and e max  -1, given the input integer signal e max  and a magnitude comparator. 
     The magnitude comparator receives the left-shifted signals 2 -S  g tmp , 1/2 g tmp , g tmp , and 2/g tmp , where g tmp  =f A  2 -r .sbsp.A +f B  2 -r .sbsp.B. If one represents g tmp  in binary form as ##EQU1## one easily verifies that |g tmp  |&lt;2 if and only if g k  =1 for some k≧1, 
     1≦|g tmp  |&lt;2 if and only if g 0  =1 and g k  =0 for all k≧1, 
     |g tmp  |&lt;1 if and only if g k  =0 for all k≧0. 
     Thus, the magnitude comparator first determines whether (1) g k  =1 for some k≧1, in which case a positive third latch signal is generated and the comparator output signal is f r  =1/2 g tmp  or (2) g k  =0 for all k≧1 and g o  =0, in which case a positive fourth latch signal is generated and the comparator output signal is f r  =g tmp  or (3) g k  =0 for all k≧0 but g -1  =1, in which case a positive fifth latch signal is generated and the comparator output signal is f r  =2 g tmp  or (4) g k  =0 for all k≧-1 in which case the result from the case |e A  -e B  |≦1 is required, i.e., 2 -S  g tmp . From the previous development it is known that for 
     
         |e.sub.A -e.sub.B |≧2 
    
     
         1/2≦|g.sub.tmp |≦5/2; 
    
     and one easily verifies from a consideration of the four cases that 1≦|f r  |&lt;2 for all cases. With the definition 
     
         e.sub.max +1 if |g.sub.tmp |≧2 
    
     
         e.sub.r =e.sub.max if 1≦|g.sub.tmp |&lt;2 
    
     
         e.sub.max -1 if 1/2≦|g.sub.tmp |&lt;1, 
    
     
         e.sub.max +S if |g.sub.tmp |&lt;1/2 
    
     one verifies that 
     
         x.sub.A +x.sub.B =2.sup.e.sbsp.max g.sub.tmp =2.sup.e.sbsp.r f.sub.r, 
    
     which displays the floating point decomposition of the sum x A  +x B  when e A  -e B  ≧2. 
     The following illustrative examples show how floating point calculations are performed according to the invention. For illustration, where negative numbers are involved, the operation of straight substration is shown (instead of the formation of 2&#39;s complements and addition). 
     EXAMPLE 1 
     Situation 1 |e a  -e B  |≦1 
     Add 
     1.111 * 2 101110  (decimal 1.875 * 2 46 ) 
     and 
     -1.000 * 2 101111  (decimal -1.000 * 2 47 ) 
     The mantissas and exponents are 
     f A  =1.111,e A  =101110, 
     f B  =-1.000, e B  =101111 
     The exponent difference |e A  -e B  |=1 
     Following the FIG. 2 path: 
     The low order bits of e A  are 10 (decimal 2) and the low order bits of e B  are 11 (decimal 3). Considering only these bits, then if the exponents are close, i.e., all the higher bits are identical, then e A  =e B  -1 so r A  =-1 and r B  =0. The higher bits are not actually checked; the computation is performed as if the condition is true. The prealignment, thus, requires only that f A  be shifted once to the right. The addition becomes ##EQU2## By counting leading zeros, S=-4, resulting in 
     
         f&#39;.sub.r =2.sup.-S f.sub.tmp =-1.0 
    
     
         e&#39;.sub.r =e.sub.max +S=101111-100=101011 (43) 
    
     Thus, the answer is -1.0 * 2 43 . 
     Following the FIG. 3 path: 
     Identical values r A  and r B  are computed (but by a different method), so the addition is as before ##EQU3## The magnitude comparator does not find a one bit in the three test bits, bit (1), bit (0) and bit (-1) (two bits before the point and one bit after) so the FIG. 3 path answers are rejected and the answer from the FIG. 2 path is selected as the correct answer (indicating that the exponent difference was at most one). 
     EXAMPLE 2 
     Situation 2 |e A  -e B  |&gt;1 
     Add 
     1.111 * 2 101100  (decimal 1.875 * 2 44 ) 
     and 
     -1.000 * 2 101111  (decimal -1.000 * 2 47 ) 
     The first path, looking only at the two low order exponent bits, i.e., e A  =00 and e B  =11, determines that if the exponents are close, then e A  =e B  -1 (which is obviously incorrect). Proceeding with r A  =0 and r B  =1 an incorrect answer is produced. The second path determines r A  =-2, r B  =0. The addition becomes ##EQU4## The magnitude comparator checks the appropriate bits of f tmp  and finds that bit (0)=0 while bit (-1)=1 so the correct result is 2 f tmp  (left shift by one) and e max  -1: 
     f r  =1.0001 
     e r  =101110 
     Thus, the result is -1.0001×2 101110  =-1.0625×2 46 . Because one of the magnitude comparator tests was satisfied, the correct answer was generated by the FIG. 3 path and the incorrect answer produced by the FIG. 2 path was ignored. 
     The foregoing description of preferred embodiments of the invention has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the scope of the invention to the precise form disclosed, and many modifications and variations are possible in light of the above teaching.