FLINT3.7.0-dev

fmpq_poly_divrem

Synopsis#include <flint/fmpq_poly.h>
void fmpq_poly_divrem(fmpq_poly_t Q, fmpq_poly_t R, const fmpq_poly_t poly1, const fmpq_poly_t poly2)source

Finds the quotient QQ and remainder RR of the Euclidean division of poly1 by poly2, so that poly1=Q⋅poly2+R\mathit{poly1} = Q \cdot \mathit{poly2} + R with deg⁡R<deg⁡poly2\deg R < \deg \mathit{poly2}. QQ and RR must be distinct objects (an exception is raised otherwise), and a zero poly2 raises FLINT_DIVZERO.

The division is done over Z\mathbb{Z} by pseudo-division (_fmpz_poly_pseudo_divrem, see division and pseudo-division), lc(B)kA=QB+R\mathrm{lc}(B)^k A = QB + R, after which the denominators are adjusted; this avoids rational arithmetic in the inner loop.

Cite this page

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