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,⌈an/2⌉)(s, \lceil \mathit{an}/2 \rceil) to ⌊a⌋\lfloor \sqrt a \rfloor and, if rr is not NULL, (r,⌈an/2⌉+1)(r, \lceil \mathit{an}/2 \rceil + 1) to the remainder a−s2≤2sa - s^2 \le 2s. Requires an≥1\mathit{an} \ge 1 and aan−1≠0a_{an-1} \ne 0. Inputs shorter than a cutoff depending on the size of BB (43 limbs for B=1019B = 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-11-02).