fmpq_simplest_between, _fmpq_simplest_between
#include <flint/fmpq.h>void _fmpq_simplest_between(fmpz_t x_num, fmpz_t x_den, const fmpz_t l_num, const fmpz_t l_den, const fmpz_t r_num, const fmpz_t r_den)sourceSet x to the simplest fraction in the closed interval between l and r, where a_1/b_1 is simpler than a_2/b_2 if b_1 < b_2, or b_1 = b_2 and a_1 < a_2. The endpoints need not be canonical, but their denominators must be positive; the result is canonical.
fmpq_simplest_between accepts the endpoints in either order; the underscore version requires l \le r. The simplest fraction is read off the common prefix of the continued fraction expansions of the endpoints, computed by _fmpq_ball_get_cfrac; see Continued fractions of rational numbers.
The FLINT team, “fmpq_simplest_between, _fmpq_simplest_between (fmpq.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fmpq/fmpq_simplest_between.html (generated 2026-10-20).
@misc{flint-doc-fmpq-fmpq-simplest-between,
author = {{The FLINT team}},
title = {{fmpq\_simplest\_between, \_fmpq\_simplest\_between (fmpq.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/fmpq/fmpq_simplest_between.html},
note = {Generated 2026-10-20}
}