.
.
.
.
.
.
Computes a mantissa of precision p, the corresponding exponent,
and the position with respect to the real square root of the
input floating-point number.
The algorithm performs the following steps:
-
Shift the mantissa so that it has at least 2p-1 digits;
shift it one digit more if the new exponent is not even.
-
Compute the square root s (at least p digits) of the new
mantissa, and its remainder r.
-
Compute the position according to the remainder:
-- r == 0 => Eq,
-- r <= s => Lo,
-- r >= s => Up.
Complexity is fine as long as p1 <= 2p-1.
.
Proof.
.