IP Library Granted Patent US 7,689,642
Granted Patent B1
US 7,689,642 · App. 11/266,838 · Granted Mar 30, 2010

Efficient accuracy check for Newton-Raphson divide and square-root operations

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 7,689,642
App. No.
11/266,838
Granted
Mar 30, 2010
Kind
B1
Abstract

One embodiment of the present invention provides a system that efficiently performs an accuracy-check computation for Newton-Raphson divide and square-root operations. During operation, the system performs Newton-Raphson iterations followed by a multiply for the divide or square-root operation. This result is then rounded to produce a proposed result. Next, the system performs an accuracy-check computation to determine whether rounding the result to a desired precision produces the correct result. This accuracy-check computation involves performing a single pass through a multiply-add pipeline to perform a multiply-add operation. During this single pass, a Booth encoding of an operand in a multiply portion of the multiply-add pipeline is modified, if necessary, to cause an additional term for the accuracy-check computation to be added to the result of the multiply-add operation. In this way, the accuracy-check computation can be completed without requiring an additional pass through the multiply-add pipeline and without an additional partial-product row in the multiply-add pipeline.

Claims (78)

1. A computer-implemented method for efficiently performing an accuracy-check computation for Newton-Raphson divide and square-root operations, wherein the method comprises:

in a computer system,

performing Newton-Raphson iterations followed by a multiply for a divide or square-root operation to produce a result; and

performing the accuracy-check computation to determine whether rounding the result to a desired precision produces the correct result;

wherein the accuracy-check computation involves performing a single pass through a multiply-add pipeline to perform a multiply-add operation, and

wherein during the single pass, a Booth encoding of an operand in a multiply portion of the multiply-add pipeline is modified, if necessary, to cause an additional term for the accuracy-check computation to be added to the result of the multiply-add operation;

whereby the accuracy-check computation is completed without requiring an additional pass through the multiply-add pipeline, and without an additional partial-product row in the multiply-add pipeline.

2. The computer-implemented method of claim 1 , wherein if the accuracy-check computation indicates that the result is not correct, the method further comprises producing the correct result by adding one to the least-significant bit of the result.

3. The computer-implemented method of claim 1 , wherein if the Newton-Raphson operation divides r by s to produce a result that is rounded down, performing the accuracy-check computation involves,

truncating the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and

computing (t*s)−r+s=(t+1)*s−r by using the multiply-add pipeline to compute (t+1)*s−r by modifying the Booth encoding of an operand in the multiply portion of the multiply-add pipeline of what otherwise would have been the computation of (t*s)−r.

4. The computer-implemented method of claim 1 , wherein if the Newton-Raphson computation divides r by s to produce a result that is rounded to the nearest representable value, performing the accuracy-check computation involves,

rounding the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and

computing (t*s)−r+s/2=(t+½)*s−r by using the multiply-add pipeline to compute (t+½)*s−r by modifying the Booth encoding of an operand in the multiply portion of the multiply-add pipeline of what otherwise would have been the computation of (t*s)−r.

5. The computer-implemented method of claim 1 , wherein if the Newton-Raphson operation divides r by s to produce a result that is rounded up, performing the accuracy-check computation involves,

rounding up the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and

computing (t*s)−r by using the multiply-add pipeline to compute (t*s)−r without modifying the Booth encoding in the multiply-add pipeline.

6. The computer-implemented method of claim 1 , wherein if the Newton-Raphson operation computes a square-root of a radicand s to produce a result that is rounded down, performing the accuracy-check computation involves,

truncating the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and

computing (t*t)−s+2t+1=(t+2)*t−s+1 by using the multiply-add pipeline to compute (t+2)*t−s by modifying the Booth encoding of an operand in the multiply portion of the multiply-add pipeline of what otherwise would have been the computation of (t*t)−s and also modifying at least one input to a carry-save adder in the pipeline to add an additional 1 to the result.

7. The computer-implemented method of claim 1 , wherein if the Newton-Raphson operation computes a square-root of a radicand s to produce a result that is rounded to the nearest representable value, performing the accuracy-check computation involves,

rounding the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and

computing (t*t)−s+t+¼=(t+1)*t−s+¼ by using the multiply-add pipeline to compute (t+1)*t−s by modifying the Booth encoding of an operand in the multiply portion of the multiply-add pipeline of what otherwise would have been the computation of (t*t)−s and also modifying at least one input to a carry-save adder in the pipeline to add an additional ¼ to the result.

8. The computer-implemented method of claim 1 , wherein if the Newton-Raphson operation computes a square-root of a radicand to produce a result that is rounded up, performing the accuracy-check computation involves,

rounding up the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and

computing (t*t)−s by using the multiply-add pipeline to compute (t*t)−s without modifying the Booth encoding in the multiply-add pipeline and without adding an additional input to a carry-save adder in the multiply-add pipeline.

9. An apparatus which efficiently performs an accuracy-check computation for Newton-Raphson divide and square-root operations, wherein the apparatus comprises:

an arithmetic unit configured to perform Newton-Raphson iterations followed by a multiply for a divide or square-root operation to produce a result; and

wherein the arithmetic unit is configured to perform the accuracy-check computation to determine whether rounding the result to a desired precision produces the correct result;

wherein during the accuracy-check computation, the arithmetic unit is configured to perform a single pass through a multiply-add pipeline to perform a multiply-add operation; and

wherein during the single pass, a Booth encoding of an operand in a multiply portion of the multiply-add pipeline is modified, if necessary, to cause an additional term for the accuracy-check computation to be added to the result of the multiply-add operation;

whereby the accuracy-check computation is completed without requiring an additional pass through the multiply-add pipeline, and without an additional partial-product row in the multiply-add pipeline.

10. The apparatus of claim 9 , wherein if the accuracy-check computation indicates that the result is not correct, the arithmetic unit is configured to produce the correct result by adding one to the least-significant bit of the result.

11. The apparatus of claim 9 , wherein if the Newton-Raphson operation divides r by s to produce a result that is rounded down, while performing the accuracy-check computation, the arithmetic unit is configured to,

truncate the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and to

compute (t*s)−r+s=(t+1)*s−r by using the multiply-add pipeline to compute (t+1)*s−r by modifying the Booth encoding of an operand in the multiply portion of the multiply-add pipeline of what otherwise would have been the computation of (t*s)−r.

12. The apparatus of claim 9 , wherein if the Newton-Raphson operation divides r by s to produce a result that is rounded to the nearest representable value, while performing the accuracy-check computation, the arithmetic unit is configured to,

round the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and to

compute (t*s)−r+s/2=(t+½)*s−r by using the multiply-add pipeline to compute (t+½)*s−r by modifying the Booth encoding of an operand in the multiply portion of the multiply-add pipeline of what otherwise would have been the computation of (t*s)−r.

13. The apparatus of claim 9 , wherein if the Newton-Raphson operation divides r by s to produce a result that is rounded up, while performing the accuracy-check computation, the arithmetic unit is configured to,

round up the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and to

compute (t*s)−r by using the multiply-add pipeline to compute (t*s)−r without modifying the Booth encoding in the multiply-add pipeline.

14. The apparatus of claim 9 , wherein if the Newton-Raphson operation computes a square-root of a radicand s to produce a result that is rounded down, while performing the accuracy-check computation, the arithmetic unit is configured to,

truncate the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and to

compute (t*t)−s+2t+1=(t+2)*t−s+1 by using the multiply-add pipeline to compute (t+2)*t−s by modifying the Booth encoding of an operand in the multiply portion of the multiply-add pipeline of what otherwise would have been the computation of (t*t)−s and also modifying at least one input to a carry-save adder in the pipeline to add an additional 1 to the result.

15. The apparatus of claim 9 , wherein if the Newton-Raphson operation computes a square-root of a radicand s to produce a result that is rounded to the nearest representable value, while performing the accuracy-check computation, the arithmetic unit is configured to,

round the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and to

compute (t*t)−s+t+¼=(t+1)*t−s+¼ by using the multiply-add pipeline to compute (t+1)*t−s by modifying the Booth encoding of an operand in the multiply portion of the multiply-add pipeline of what otherwise would have been the computation of (t*t)−s and also modifying at least one input to a carry-save adder in the pipeline to add an additional ¼ to the result.

16. The apparatus of claim 9 , wherein if the Newton-Raphson operation computes a square-root of a radicand s to produce a result that is rounded up, while performing the accuracy-check computation, the arithmetic unit is configured to,

round up the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and to

compute (t*t)−s by using the multiply-add pipeline to compute (t*t)−s without modifying the Booth encoding in the multiply-add pipeline and without adding an additional input to a carry-save adder in the multiply-add pipeline.

17. A computer system with an arithmetic unit which efficiently performs an accuracy-check computation for Newton-Raphson divide and square-root operations, wherein the computer system comprises:

a processor;

a memory;

an arithmetic unit within the processor configured to perform Newton-Raphson iterations followed by a multiply for a divide or square-root operation to produce a result; and

wherein the arithmetic unit is configured to perform the accuracy-check computation to determine whether rounding the result to a desired precision produces the correct result;

wherein during the accuracy-check computation, the arithmetic unit is configured to perform a single pass through a multiply-add pipeline to perform a multiply-add operation; and

wherein during the single pass, a Booth encoding of an operand in a multiply portion of the multiply-add pipeline is modified, if necessary, to cause an additional term for the accuracy-check computation to be added to the result of the multiply-add operation;

whereby the accuracy-check computation is completed without requiring an additional pass through the multiply-add pipeline, and without an additional partial-product row in the multiply-add pipeline.

18. The computer system of claim 17 , wherein if the accuracy-check computation indicates that the result is not correct, the arithmetic unit is configured to produce the correct result by adding one to the least-significant bit of the result.

19. The computer system of claim 17 , wherein if the Newton-Raphson operation divides r by s to produce a result that is rounded down, while performing the accuracy-check computation, the arithmetic unit is configured to,

truncate the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and to

compute (t*s)−r+s=(t+1)*s−r by using the multiply-add pipeline to compute (t+1)*s−r by modifying the Booth encoding of an operand in the multiply portion of the multiply-add pipeline of what otherwise would have been the computation of (t*s)−r.

20. The computer system of claim 17 , wherein if the Newton-Raphson operation divides r by s to produce a result that is rounded to the nearest representable value, while performing the accuracy-check computation, the arithmetic unit is configured to,

round the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and to

compute (t*s)−r+s/2=(t+½)*s−r by using the multiply-add pipeline to compute (t+½)*s−r by modifying the Booth encoding of an operand in the multiply portion of the multiply-add pipeline of what otherwise would have been the computation of (t*s)−r.

21. The computer system of claim 17 , wherein if the Newton-Raphson operation divides r by s to produce a result that is rounded up, while performing the accuracy-check computation, the arithmetic unit is configured to,

round up the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and to

compute (t*s)−r by using the multiply-add pipeline to compute (t*s)−r without modifying the Booth encoding in the multiply-add pipeline.

22. The computer system of claim 17 , wherein if the Newton-Raphson operation computes a square-root of a radicand s to produce a result that is rounded down, while performing the accuracy-check computation, the arithmetic unit is configured to,

truncate the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and to

compute (t*t)−s+2t+1=(t+2)*t−s+1 by using the multiply-add pipeline to compute (t+2)*t−s by modifying the Booth encoding of an operand in the multiply portion of the multiply-add pipeline of what otherwise would have been the computation of (t*t)−s and also modifying at least one input to a carry-save adder in the pipeline to add an additional 1 to the result.

23. The computer system of claim 17 , wherein if the Newton-Raphson operation computes a square-root of a radicand s to produce a result that is rounded to the nearest representable value, while performing the accuracy-check computation, the arithmetic unit is configured to,

round the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and to

compute (t*t)−s+t+¼=(t+1)*t−s+¼ by using the multiply-add pipeline to compute (t+1)*t−s by modifying the Booth encoding of an operand in the multiply portion of the multiply-add pipeline of what otherwise would have been the computation of (t*t)−s and also modifying at least one input to a carry-save adder in the pipeline to add an additional ¼ to the result.

24. The computer system of claim 17 , wherein if the Newton-Raphson operation computes a square-root of a radicand s to produce a result that is rounded up, while performing the accuracy-check computation, the arithmetic unit is configured to,

round up the extra-precision result of the Newton-Raphson method to produce a value t with the desired precision; and to

compute (t*t)−s by using the multiply-add pipeline to compute (t*t)−s without modifying the Booth encoding in the multiply-add pipeline and without adding an additional input to a carry-save adder in the multiply-add pipeline.

Assignments (1)
MERGER AND CHANGE OF NAME Recorded Dec 16, 2015
From: ORACLE USA, INC.; SUN MICROSYSTEMS, INC.; ORACLE AMERICA, INC.
To: ORACLE AMERICA, INC.
Reel/Frame 037306/0268 →