decfloat_set_round_qqbar, decfloat_set_qqbar, decball_set_qqbar, deccfloat_set_qqbar, deccball_set_qqbar
#include <flint/decimal.h>int decfloat_set_round_qqbar(decfloat_t res, const qqbar_t x, slong prec, int rnd, gr_ctx_t ctx)sourceint decfloat_set_qqbar(decfloat_t res, const qqbar_t x, gr_ctx_t ctx)sourceint deccfloat_set_qqbar(deccfloat_t res, const qqbar_t x, gr_ctx_t ctx)sourceint deccball_set_qqbar(deccball_t res, const qqbar_t x, gr_ctx_t ctx)sourceConverts the algebraic number x; these are also used by set_other for elements of the qqbar rings. The prototypes are available when qqbar.h is included (before or after decimal.h). The real and imaginary parts are converted separately: floating-point results are correctly rounded (the imaginary part of a deccfloat in the imaginary rounding mode), and a ball part is exact (has zero radius) whenever the part is a decimal number of at most the context precision that is within the exponent range; for example, \sqrt{2} + 0.0023 i gives an exact imaginary part at a precision of two or more digits. The real conversions return GR_DOMAIN for a nonreal x.
The conversion first rounds a numerical enclosure obtained by refining the enclosure of x. Only when this cannot decide the result (a floating-point part lying on a rounding boundary, or a ball part whose enclosure contains a decimal number of at most the precision) is it checked exactly whether the part equals that decimal number: for the real part by subtracting the rational number, for the imaginary part by subtracting its product with i (a resultant computation), and then testing whether the real or imaginary part of the difference vanishes. The real part of a real algebraic number of degree greater than one is irrational and needs no check. With an exact target precision, a part must be an exact decimal number (computed exactly if x is not rational), otherwise GR_UNABLE is returned.
The FLINT team, “decfloat_set_round_qqbar, decfloat_set_qqbar, decball_set_qqbar, deccfloat_set_qqbar, deccball_set_qqbar (decimal.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/decimal/decfloat_set_round_qqbar.html (generated 2026-10-20).
@misc{flint-doc-decimal-decfloat-set-round-qqbar,
author = {{The FLINT team}},
title = {{decfloat\_set\_round\_qqbar, decfloat\_set\_qqbar, decball\_set\_qqbar, deccfloat\_set\_qqbar, deccball\_set\_qqbar (decimal.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/decimal/decfloat_set_round_qqbar.html},
note = {Generated 2026-10-20}
}