Reputation: 3657
I am wondering if there are any algorithms to perform a floating-point division that would be accelerated if one has access to a floating point square root unit in hardware?
If so, what are those algorithms?
Upvotes: 0
Views: 500
Reputation: 1191
Division by square root is actually the way division operation is usually implemented in hardware. To be more precise the square root unit almost universally internally computes reciprocal square root (1/sqrt(X)
), because with it one can easily perform both division and square root operations: sqrt(x) = x*(1/sqrt(x))
and R=X/Y=X*Z*Z
where Z=1/sqrt(Y)
.
If there is a hardware instruction that returns an estimate, you can improve the result by the following iterative method:
Z = Z * (3-Y*Z*Z )/2
Upvotes: 1