FLINT3.7.0-dev

radix_sqrtrem

Synopsis#include <flint/radix.h>
void radix_sqrtrem(nn_ptr s, nn_ptr r, nn_srcptr a, slong an, const radix_t radix)source

Sets (s, \lceil \mathit{an}/2 \rceil) to \lfloor \sqrt a \rfloor and, if r is not NULL, (r, \lceil \mathit{an}/2 \rceil + 1) to the remainder a - s^2 \le 2s. Requires \mathit{an} \ge 1 and a_{an-1} \ne 0. Inputs shorter than a cutoff depending on the size of B (43 limbs for B = 10^{19}) are converted to binary and use flint_mpn_sqrtrem; longer ones use the Newton square root.

Cite this page

The FLINT team, “radix_sqrtrem (radix.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/radix/radix_sqrtrem.html (generated 2026-10-20).