摘要 |
One embodiment of the present invention provides a system that uses the Newton-Raphson technique to compute a square-root. During operation, the system receives a radicand b. Next, the system calculates the square root of b, √{square root over (b)}, by first using the Newton-Raphson technique to find 1/√{square root over (b)}, and then multiplying 1/√{square root over (b)} by b to produce √{square root over (b)}. While using the Newton-Raphson technique to find 1/√{square root over (b)}, the system first obtains an initial estimate x0 for 1/√{square root over (b)} and then iteratively solves the equation <maths id="MATH-US-00001" num="00001"> <math overflow="scroll"> <mrow> <msub> <mi>x</mi> <mrow> <mi>i</mi> <mo>+</mo> <mn>1</mn> </mrow> </msub> <mo>=</mo> <mrow> <msub> <mi>x</mi> <mi>i</mi> </msub> <mo></mo> <mstyle> <mspace width="0.3em" height="0.3ex"/> </mstyle> <mo></mo> <mrow> <mrow> <mo>(</mo> <mfrac> <mrow> <mn>3</mn> <mo>-</mo> <msubsup> <mi>bx</mi> <mi>i</mi> <mn>2</mn> </msubsup> </mrow> <mn>2</mn> </mfrac> <mo>)</mo> </mrow> <mo>.</mo> </mrow> </mrow> </mrow> </math> </maths> Each iteration involves: (1) using a multiplier circuit twice to compute bxi2; (2) performing a bit-wise complement operation on bxi2, shifting the result, and modifying the first two bits of the result to compute <maths id="MATH-US-00002" num="00002"> <math overflow="scroll"> <mrow> <mfrac> <mrow> <mn>3</mn> <mo>-</mo> <msubsup> <mi>bx</mi> <mi>i</mi> <mn>2</mn> </msubsup> </mrow> <mn>2</mn> </mfrac> <mo>,</mo> </mrow> </math> </maths> whereby an additional pass through an adder circuit or a multiply/add circuit is not required to perform the subtraction operation; and finally (3) using the multiplier circuit to multiply xi by <maths id="MATH-US-00003" num="00003"> <math overflow="scroll"> <mfrac> <mrow> <mn>3</mn> <mo>-</mo> <msubsup> <mi>bx</mi> <mi>i</mi> <mn>2</mn> </msubsup> </mrow> <mn>2</mn> </mfrac> </math> </maths> to compute <maths id="MATH-US-00004" num="00004"> <math overflow="scroll"> <mrow> <msub> <mi>x</mi> <mi>i</mi> </msub> <mo></mo> <mstyle> <mspace width="0.3em" height="0.3ex"/> </mstyle> <mo></mo> <mrow> <mrow> <mo>(</mo> <mfrac> <mrow> <mn>3</mn> <mo>-</mo> <msubsup> <mi>bx</mi> <mi>i</mi> <mn>2</mn> </msubsup> </mrow> <mn>2</mn> </mfrac> <mo>)</mo> </mrow> <mo>.</mo> </mrow> </mrow> </math> </maths>
|