FLINT3.7.0-dev

decfloat_set_round_qqbar, decfloat_set_qqbar, decball_set_qqbar, deccfloat_set_qqbar, deccball_set_qqbar

Synopsis#include <flint/decimal.h>
int decfloat_set_round_qqbar(decfloat_t res, const qqbar_t x, slong prec, int rnd, gr_ctx_t ctx)source
int decfloat_set_qqbar(decfloat_t res, const qqbar_t x, gr_ctx_t ctx)source
int decball_set_qqbar(decball_t res, const qqbar_t x, gr_ctx_t ctx)source
int deccfloat_set_qqbar(deccfloat_t res, const qqbar_t x, gr_ctx_t ctx)source
int deccball_set_qqbar(deccball_t res, const qqbar_t x, gr_ctx_t ctx)source

Converts 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, 2+0.0023i\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 ii (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.

Cite this page

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-11-02).