FLINT3.7.0-dev

_fmpz_poly_num_real_roots, fmpz_poly_num_real_roots

Synopsis#include <flint/fmpz_poly.h>
slong _fmpz_poly_num_real_roots(const fmpz * pol, slong len)source
slong fmpz_poly_num_real_roots(const fmpz_poly_t poly)source

Return the number of real roots of the squarefree polynomial poly, including a root at zero. A zero polynomial raises an exception.

Degrees up to 4 use closed formulas based on the discriminant. Otherwise Descartes' rule of signs is tried first; it decides the answer when f(x) and f(-x) each have at most one sign variation. Short polynomials with small coefficients use the subresultant Sturm sequence; larger ones first try a primitive Sturm sequence (_fmpz_poly_num_real_roots_sturm_bounded) with a bound that detects coefficient growth, and fall back on the Vincent–Collins–Akritas algorithm.

Cite this page

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