FLINT3.7.0-dev

flint_mpn_bdiv_qr, flint_mpn_bdiv_q

Synopsis#include <flint/mpn_extras.h>
void flint_mpn_bdiv_qr(mp_ptr q, mp_ptr r, mp_srcptr a, mp_size_t an, mp_srcptr b, mp_size_t bn, mp_size_t n)source
void flint_mpn_bdiv_q(mp_ptr q, mp_srcptr a, mp_size_t an, mp_srcptr b, mp_size_t bn, mp_size_t n)source

Hensel division: for odd (b, \mathit{bn}), sets (q, n) to the 2-adic quotient with qb \equiv a \pmod{B^n}. If r is not NULL (it is NULL for bdiv_q), the remainder (a - qb)/B^n \bmod B^{\mathit{bn}} is written to (r, \mathit{bn}), so that a \equiv qb + B^n r \pmod{B^{n + \mathit{bn}}}; the division is exact with an n-limb quotient if and only if r = 0 and a has no nonzero limbs at positions \ge n + \mathit{bn}. q may alias a. Unlike GMP's mpn_bdiv_qr, the number n of quotient limbs is a parameter independent of \mathit{an} and \mathit{bn}.

Cite this page

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