FLINT3.7.0-dev

deccfloat_set, deccfloat_set_round, deccfloat_set_decfloat, deccfloat_set_decfloat_decfloat, deccfloat_set_si, deccfloat_set_ui, deccfloat_set_fmpz, deccfloat_set_fmpq, deccfloat_set_d, deccfloat_set_str, deccfloat_set_other, deccfloat_set_fmpz_10exp_fmpz, deccfloat_set_fmpz_2exp_fmpz, deccfloat_set_acf, deccfloat_set_acb, deccfloat_get_acf, deccfloat_get_acb, deccfloat_get_fmpz, deccfloat_get_fmpq, deccfloat_get_si, deccfloat_get_ui, deccfloat_get_d, deccfloat_get_re, deccfloat_get_im

Synopsis#include <flint/decimal.h>
int deccfloat_set(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)source
int deccfloat_set_round(deccfloat_t res, const deccfloat_t x, slong prec, int rnd, int rnd_im, gr_ctx_t ctx)source
int deccfloat_set_decfloat(deccfloat_t res, const decfloat_t x, gr_ctx_t ctx)source
int deccfloat_set_decfloat_decfloat(deccfloat_t res, const decfloat_t re, const decfloat_t im, gr_ctx_t ctx)source
int deccfloat_set_si(deccfloat_t res, slong x, gr_ctx_t ctx)source
int deccfloat_set_ui(deccfloat_t res, ulong x, gr_ctx_t ctx)source
int deccfloat_set_fmpz(deccfloat_t res, const fmpz_t x, gr_ctx_t ctx)source
int deccfloat_set_fmpq(deccfloat_t res, const fmpq_t x, gr_ctx_t ctx)source
int deccfloat_set_d(deccfloat_t res, double x, gr_ctx_t ctx)source
int deccfloat_set_str(deccfloat_t res, const char * s, gr_ctx_t ctx)source
int deccfloat_set_other(deccfloat_t res, gr_srcptr x, gr_ctx_t x_ctx, gr_ctx_t ctx)source
int deccfloat_set_fmpz_10exp_fmpz(deccfloat_t res, const fmpz_t m, const fmpz_t e, gr_ctx_t ctx)source
int deccfloat_set_fmpz_2exp_fmpz(deccfloat_t res, const fmpz_t m, const fmpz_t e, gr_ctx_t ctx)source
int deccfloat_set_acf(deccfloat_t res, const acf_t x, gr_ctx_t ctx)source
int deccfloat_set_acb(deccfloat_t res, const acb_t x, gr_ctx_t ctx)source
int deccfloat_get_acf(acf_t res, const deccfloat_t x, slong prec_bits, int rnd, gr_ctx_t ctx)source
int deccfloat_get_acb(acb_t res, const deccfloat_t x, slong prec_bits, gr_ctx_t ctx)source
int deccfloat_get_fmpz(fmpz_t res, const deccfloat_t x, gr_ctx_t ctx)source
int deccfloat_get_fmpq(fmpq_t res, const deccfloat_t x, gr_ctx_t ctx)source
int deccfloat_get_si(slong * res, const deccfloat_t x, gr_ctx_t ctx)source
int deccfloat_get_ui(ulong * res, const deccfloat_t x, gr_ctx_t ctx)source
int deccfloat_get_d(double * res, const deccfloat_t x, gr_ctx_t ctx)source
int deccfloat_get_re(decfloat_t res, const deccfloat_t x, gr_ctx_t ctx)source
int deccfloat_get_im(decfloat_t res, const deccfloat_t x, gr_ctx_t ctx)source

Assignment and conversions, with the parts rounded to the context precision in the respective rounding modes (deccfloat_set_round takes the precision and both modes explicitly). The conversions to real numbers or integers return GR_DOMAIN for a nonzero imaginary part.

set_other accepts elements of all the decimal rings (a ball is converted to its midpoint, or returns GR_UNABLE when inexact and the target precision is exact), of acf, acb, arf, arb, qqbar (correctly rounded, see deccfloat_set_qqbar) and of the rings accepted by decfloat_set_other; deccfloat and deccball are conversely accepted by gr_set_other in the fmpz, fmpq, arf, arb, acf and acb rings and in all the decimal rings. Strings of the form "a", "b*I", "(a + b*I)" and "(a - b*I)" with plain decimal literals a and b (the output format) are parsed and rounded directly; any other string, such as "1+2*I", "I^2" or "(3+4*I)^(1/2)", goes through the generic expression parser with I bound to the imaginary unit and every operation rounded (with an exact result in the examples above).

Cite this page

The FLINT team, “deccfloat_set, deccfloat_set_round, deccfloat_set_decfloat, deccfloat_set_decfloat_decfloat, deccfloat_set_si, deccfloat_set_ui, deccfloat_set_fmpz, deccfloat_set_fmpq, deccfloat_set_d, deccfloat_set_str, deccfloat_set_other, deccfloat_set_fmpz_10exp_fmpz, deccfloat_set_fmpz_2exp_fmpz, deccfloat_set_acf, deccfloat_set_acb, deccfloat_get_acf, deccfloat_get_acb, deccfloat_get_fmpz, deccfloat_get_fmpq, deccfloat_get_si, deccfloat_get_ui, deccfloat_get_d, deccfloat_get_re, deccfloat_get_im (decimal.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/decimal/deccfloat_set.html (generated 2026-10-20).