Claims
- 1. An apparatus for performing an arithmetic operation using first and second floating point numbers, comprising:
a first calculator configured to perform a first operation on the first and second floating point numbers to produce a first result; a second calculator configured to perform a second operation on the first and second floating point numbers to produce a second result; and a selector configured to select and output the first result when (1) the arithmetic operation and respective signs of the first and second floating point numbers indicate an effective arithmetic operation of subtraction, (2) a difference between respective significands of the first and second floating point numbers is in a predetermined range, and (3) an absolute value of a difference between respective exponents of the first and second floating point numbers is less than a predetermined value, and otherwise to select and output the second result.
- 2. The apparatus of claim 1, wherein the first calculator comprises:
a first subtractor configured to calculate the difference between the respective exponents of the first and second floating point numbers; an aligning and swapping device configured to determine a largest of the first and second floating point numbers and to align bits of the respective significands of the first and second floating point numbers based on a result of the first subtractor; an adder configured to calculate a sum of significands produced by the aligning and swapping device; a leading-zero estimator configured to estimate a number of leading zeros based on the significands produced by the aligning and swapping device; a leading zero selector configured to select a number of leading zeros based on a result of the leading-zero estimator and a result of the adder; a converter configured to compute an absolute value of the result of the adder; and a normalizing element configured to normalize the absolute value based on a result of the leading zero selector to produce the first result, whereby said first operation is performed.
- 3. The apparatus of claim 1, wherein the second calculator comprises:
a first subtractor configured to calculate the difference between the respective exponents of the first and second floating point numbers; a negating element configured to negate the respective significands of the first and second floating point numbers; a first aligning element configured to preshift and align the respective significands based on the effective arithmetic operation and a result of the first subtractor; a swapping element configured to select, among results of the first aligning element, a minuend significand and a subtrahend significand, based on the result of the first subtractor; a second aligning element configured to align the subtrahend significand based on the result of the first subtractor; a first computing element configured to compute a least significant bit of a difference between the minuend and subtrahend significands; a second computing element configured to compute remaining bits of the difference between the minuend and subtrahend significands; a normalizing element configured to normalize a result of the second computing element; and a rounding element configured to round a result of the normalizing element to produce the second result, whereby said second operation is performed.
- 4. An method for performing an arithmetic operation using first and second floating point numbers, comprising:
performing a first operation on the first and second floating point numbers to produce a first result; performing a second operation on the first and second floating point numbers to produce a second result; and selecting and outputting the first result when (1) the arithmetic operation and respective signs of the first and second floating point numbers indicate an effective arithmetic operation of subtraction, (2) a difference between respective significands of the first and second floating point numbers is in a predetermined range, and (3) an absolute value of a difference between respective exponents of the first and second floating point numbers is less than a predetermined value, and otherwise selecting and outputting the second result.
- 5. The method of claim 4, wherein the step of performing the first operation comprises:
calculating the difference between the respective exponents of the first and second floating point numbers; determining a largest of the first and second floating point numbers and aligning bits of the respective significands of the first and second floating point numbers based on the difference between the respective exponents of the first and second floating point numbers; summing significands determined in the determining step; estimating a number of leading zeros based on the significands determined in the determining step; selecting a number of leading zeros based on a result of the estimating step and a result of the summing step; computing an absolute value of the result of the summing step; and normalizing the absolute value based on a result of the selecting step to produce the first result.
- 6. The method of claim 4, wherein the step of performing the second operation comprises:
calculating the difference between the respective exponents of the first and second floating point numbers; negating the respective significands of the first and second floating point numbers; aligning and preshifting the significands based on the effective arithmetic operation and the difference between the respective exponents of the first and second floating point numbers; selecting, among results of the aligning step, a minuend significand and a subtrahend significand, based on the difference between the respective exponents of the first and second floating point numbers; realigning the subtrahend significand based on the difference between the respective exponents of the first and second floating point numbers; computing a least significant bit of a difference between the minuend and subtrahend significands; computing remaining bits of the difference between the minuend and subtrahend significands; normalizing the remaining bits of the difference between the significands computed in the previous computing step; and rounding a result of the normalizing step to produce the second result.
CROSS-REFERENCE TO RELATED APPLICATION
[0001] The present application claims priority to U.S. Provisional Patent Application No. 60/288,430, filed May 4, 2001, the entire contents of which are incorporated herein by reference.
Provisional Applications (1)
|
Number |
Date |
Country |
|
60288430 |
May 2001 |
US |