FLINT3.7.0-dev

flint_mpn_invapprox, _flint_mpn_invapprox_buf

Synopsis#include <flint/mpn_extras.h>
void flint_mpn_invapprox(mp_ptr q, mp_srcptr x, mp_size_t xn, mp_size_t n)source
mp_ptr _flint_mpn_invapprox_buf(mp_ptr U, mp_srcptr x, mp_size_t xn, mp_size_t n)source

Approximate reciprocal with the interface of flint_mpn_inv: sets (q,n−xn+2)(q, n - \mathit{xn} + 2) to ⌊Bn/x⌋\lfloor B^n / x \rfloor or ⌊Bn/x⌋+1\lfloor B^n / x \rfloor + 1. It uses the algorithms of flint_mpn_inv (with the same cutoffs) without the correction steps, and above the Newton cutoffs _mp_real_inv_newton with one guard limb instead of three, so that it is never slower. The underscore version takes a buffer UU of n−xn+4n - \mathit{xn} + 4 limbs, which also serves as the scratch of the Newton iteration, and returns the pointer (UU or U+2U + 2) to the result, saving a temporary and a copy.

Cite this page

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