decball_set, decball_set_round, decball_set_round2, decball_set_decfloat, decball_set_si, decball_set_ui, decball_set_fmpz, decball_set_fmpq, decball_set_d, decball_set_str, decball_set_fmpz_10exp_fmpz, decball_set_other, decball_set_arb, decball_get_arb, decball_get_fmpz, decball_get_fmpq, decball_get_d, decball_get_mid, decball_get_rad, decball_get_abs_ubound, decball_get_abs_lbound
#include <flint/decimal.h>int decball_set_round2(decball_t res, const decball_t x, slong prec, slong rad_prec, gr_ctx_t ctx)sourceint decball_set_decfloat(decball_t res, const decfloat_t x, gr_ctx_t ctx)sourceint decball_get_mid(decfloat_t res, const decball_t x, gr_ctx_t ctx)sourceAssignment and conversions. Values are rounded to the context precision with the rounding error added to the radius, and radii are rounded up to the radius precision of the context; set_round rounds the midpoint to prec digits instead and set_round2 additionally rounds the radius up to rad_prec digits (both preserve the enclosure). Integer conversion succeeds for exact integer balls, returns GR_DOMAIN for balls containing no integer, and GR_UNABLE otherwise.
An arb ball with an infinite or NaN midpoint is not a real number and converts with GR_DOMAIN respectively GR_UNABLE; one with an infinite radius converts to [0 \pm \infty]. Plain decimal literals are parsed exactly (then rounded); any other string goes through the generic expression parser, so "[mid +/- rad]" (the output format), "mid +/- rad", "+/- rad" and arithmetic expressions are accepted, and the same syntax works inside strings for polynomials, matrices and other objects over decimal balls. A radius smaller than 10^{emin} can only be parsed when underflow is allowed in the context. Since inf is not an element of the ring, the printed forms of balls with an infinite radius ("[m +/- inf]", "[+/- inf]") are parsed through set_interval_mid_inf rather than by evaluating inf. Algebraic numbers are converted with decball_set_qqbar, which gives an exact ball for an exactly representable value. The conversions to and from arb are rigorous (the radius accounts for all conversion errors) and handle arbitrarily large exponents by scaling with a power of ten. The conversion from arb is also tight: the midpoint is correctly rounded and the exact rounding error, bounded to the radius precision, is added to the radius, and an exact midpoint that is exactly representable at the context precision gives an exact ball even when its exponent is huge; when scaling in arb is used, the working precision is increased until the scaling error is negligible compared to the radius (unless this would require an unreasonable precision).
Guides#
The FLINT team, “decball_set, decball_set_round, decball_set_round2, decball_set_decfloat, decball_set_si, decball_set_ui, decball_set_fmpz, decball_set_fmpq, decball_set_d, decball_set_str, decball_set_fmpz_10exp_fmpz, decball_set_other, decball_set_arb, decball_get_arb, decball_get_fmpz, decball_get_fmpq, decball_get_d, decball_get_mid, decball_get_rad, decball_get_abs_ubound, decball_get_abs_lbound (decimal.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/decimal/decball_set.html (generated 2026-10-20).
@misc{flint-doc-decimal-decball-set,
author = {{The FLINT team}},
title = {{decball\_set, decball\_set\_round, decball\_set\_round2, decball\_set\_decfloat, decball\_set\_si, decball\_set\_ui, decball\_set\_fmpz, decball\_set\_fmpq, decball\_set\_d, decball\_set\_str, decball\_set\_fmpz\_10exp\_fmpz, decball\_set\_other, decball\_set\_arb, decball\_get\_arb, decball\_get\_fmpz, decball\_get\_fmpq, decball\_get\_d, decball\_get\_mid, decball\_get\_rad, decball\_get\_abs\_ubound, decball\_get\_abs\_lbound (decimal.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/decimal/decball_set.html},
note = {Generated 2026-10-20}
}