FLINT3.7.0-dev

arb_can_round_arf, arb_can_round_mpfr

Synopsis#include <flint/arb.h>
int arb_can_round_arf(const arb_t x, slong prec, arf_rnd_t rnd)source
int arb_can_round_mpfr(const arb_t x, slong prec, mpfr_rnd_t rnd)source

Return nonzero if rounding the midpoint of x to prec bits in the direction rnd is guaranteed to give the correctly rounded value of every real number in x.

If the function returns nonzero, arf_set_round, arf_get_mpfr (with an output variable of precision prec) or arf_get_d (with prec = 53) applied to the midpoint give a correctly rounded result, and arf_get_mpfr also returns the correct MPFR ternary value. This is how a correctly rounded function can be built on ball arithmetic: evaluate with a few guard bits, and repeat at higher precision while this test fails. The test is fast and conservative: it may return 0 when rounding is in fact possible. It returns 0 for non-finite x, even an exact infinity. The two versions differ only in the type of the rounding mode.

Guides#

Cite this page

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