FLINT3.7.0-dev

radix_divrem

Synopsis#include <flint/radix.h>
void radix_divrem(nn_ptr q, nn_ptr r, nn_srcptr a, slong an, nn_srcptr b, slong bn, const radix_t radix)source

Sets (q, \mathit{an} - \mathit{bn} + 1) to \lfloor a/b \rfloor and, if r is not NULL, (r, \mathit{bn}) to the remainder. Requires \mathit{an} \ge \mathit{bn} \ge 1 and b_{bn-1} \ne 0.

One-limb divisors use radix_divrem_1. Divisors of at least 70 limbs, and divisors of at least 20 limbs with quotients of at most 150 limbs, use radix_divrem_newton_karp_markstein. Otherwise long quotients (\mathit{an} > 2\mathit{bn}) are computed blockwise by 2\mathit{bn} \times \mathit{bn} divisions, and the remaining divisions convert to binary and use flint_mpn_tdiv_qr (radix_divrem_via_mpn).

Cite this page

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