mini-gmp mpm_sqrtrem

bodrato at bodrato at
Sat Feb 22 10:06:43 UTC 2014


Il Sab, 22 Febbraio 2014 7:46 am, Niels ha scritto:
> I had a look at the new mpn_sqrtrem function in mini-gmp. Nice and

> The docs says that the result area is ceil(n/2) limbs. Is it possible
> that the top limb can be zero? If so, the code omits writing the leading

Let x = ceil(n/2), then n >= 2x-1, the minimum number that can be
represented with n limbs is B^(n-1) >= B^(2x-2). Its root is >= B^(x-1),
that require at least x limbs to be represented.


I'll add the assert.



More information about the gmp-devel mailing list