sqrt algorithm
Torbjörn Granlund
tg at gmplib.org
Wed Jul 29 20:43:18 UTC 2015
nisse at lysator.liu.se (Niels Möller) writes:
Hmm, but if we shift to make the *root* normalized, that also means that
the input will always be an even number of limbs. Not entirely sure
that's good, in particular for smallish sizes. But it ought to simplify
some things.
I've seen code along these lines somewhere: :-)
if (BELOW_THRESHOLD (n, NISSE_SQRT_THREASHOLD)
sqrt_basecase (...);
else
{
count_leading_zeros (cnt, ...);
mpn_lshift (..., cnt);
sqrt_nisse (...);
}
--
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-devel
mailing list