flint_mpn_bdiv_qr, flint_mpn_bdiv_q
#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)sourcevoid 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)sourceHensel 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}.
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).
@misc{flint-doc-mpn-extras-flint-mpn-bdiv-qr,
author = {{The FLINT team}},
title = {{flint\_mpn\_bdiv\_qr, flint\_mpn\_bdiv\_q (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_bdiv_qr.html},
note = {Generated 2026-10-20}
}