flint_mpn_sqrthigh, flint_mpn_sqrthigh_exact, flint_mpn_sqrthigh_exact_half, flint_mpn_sqrthigh_exact_rem, flint_mpn_rsqrthigh, flint_mpn_rsqrthigh_exact
#include <flint/mpn_extras.h>The square root and the reciprocal square root with the contract above ( for the approximations; the exact variants also accept , a single limb). flint_mpn_sqrthigh_exact_half returns more precisely 0 (exact), 1 (the root within the first half unit above the floor), 2 (exactly half a unit above: a tie, which needs dropped limbs of ) or 3 (above that), which decides every rounding mode at limbs; it forms the remainder of the integer root (for the floor of the radicand with the dropped fraction , the root exceeds iff , or and ), which the plain variant skips; flint_mpn_sqrthigh_exact_rem writes that remainder to r ( limbs, zero-padded) and returns the inexact flag. flint_mpn_rsqrthigh_exact requires .
On 64-bit machines, roots of one and two limbs (two and three with the guard limb) come from the register kernels of mpn_extras/fp_small.h: the double precision value refined by one Newton step with the exact residual at 128 bits (_flint_mpn_small_rsqrt_2, within 8 units), the square root as the product with the operand (within 24 units) and a further step at three limbs (within 3 units, resp. 2 for the reciprocal square root). Longer square roots are flint_mpn_sqrtrem of the operand truncated or zero-extended to limbs below FLINT_MPN_SQRTREM_NEWTON_CUTOFF result limbs and the Newton iteration of mp_real beyond. Longer reciprocal square roots use a Newton iteration on short products from the two-limb base (error below 196 units at four limbs, below 1.03 beyond) up to 96 limbs and the iteration of mp_real beyond. The exact variants take flint_mpn_sqrtrem of the exact radicand (for the reciprocal, by a division with remainder), the result being exact iff all remainders vanish.
The FLINT team, “flint_mpn_sqrthigh, flint_mpn_sqrthigh_exact, flint_mpn_sqrthigh_exact_half, flint_mpn_sqrthigh_exact_rem, flint_mpn_rsqrthigh, flint_mpn_rsqrthigh_exact (mpn_extras.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/mpn_extras/flint_mpn_sqrthigh.html (generated 2026-11-20).
@misc{flint-doc-mpn-extras-flint-mpn-sqrthigh,
author = {{The FLINT team}},
title = {{flint\_mpn\_sqrthigh, flint\_mpn\_sqrthigh\_exact, flint\_mpn\_sqrthigh\_exact\_half, flint\_mpn\_sqrthigh\_exact\_rem, flint\_mpn\_rsqrthigh, flint\_mpn\_rsqrthigh\_exact (mpn\_extras.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/mpn_extras/flint_mpn_sqrthigh.html},
note = {Generated 2026-11-20}
}