FLINT3.7.0-dev

flint_mpn_divapprox_fraction

Synopsis#include <flint/mpn_extras.h>
void flint_mpn_divapprox_fraction(mp_ptr q, mp_srcptr a, mp_size_t an, mp_srcptr b, mp_size_t bn, mp_size_t f)source

Sets (q, \mathit{an} - \mathit{bn} + 1 + f) to \lfloor a B^f / b \rfloor or \lfloor a B^f / b \rfloor + 1, the approximate quotient with f fraction limbs. A negative f (with \mathit{an} - \mathit{bn} + 1 + f \ge 1) gives the top limbs of the quotient.

The algorithm is that of flint_mpn_divapprox on the zero padded numerator, so that short divisors with many fraction limbs cost O(qn \cdot \mathit{bn}); the padded numerator is only formed for the register-based, schoolbook, blockwise and divide and conquer algorithms, not for the short and Newton divisions.

Cite this page

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