gr_ctx_init_dfloat
#include <flint/dfloat.h>Initialises ctx to a generic ring of n-term expansions, 1 \le n \le 4. The flags select the format: without DFLOAT_BALL the elements are plain dN numbers (an approximate floating-point ring), with it dNb balls (a rigorous representation of \mathbb{R}); with DFLOAT_COMPLEX the complex formats dNc or dNcb. Passing 0 or 1 selects the plain or the ball real ring with the defaults. Returns GR_UNABLE if n is out of range or dfloat_is_supported returns 0, and GR_SUCCESS otherwise.
The element size is 8(n + b) bytes, with b = 1 for balls and 0 otherwise, and twice that for the complex rings. The real ball ring reports itself as a field, ordered, real, inexact and non-canonical, like gr_ctx_init_real_arb, and the complex ball ring as an algebraically closed field like gr_ctx_init_complex_acb. The precision reported by gr_ctx_get_real_prec is 53n bits and cannot be changed.
With DFLOAT_STRONG, the arithmetic operations (add, sub, mul, sqr, div, inv, sqrt, rsqrt, exp, log, sin, cos, sin_cos, atan and the vector operations) canonicalise their results; this makes equal on plain numbers a comparison of values and costs up to 60% on the cheapest operations for n = 3, 4. With DFLOAT_FAST (balls only), products bound their rounding errors instead of tracking them exactly when both inputs are exact; this is slightly cheaper but loses exactness ((2^{60} + 1) \cdot 3 then gets a radius of about 2^{-46}).
The rings implement only operations with native code: the arithmetic, the elementary functions documented below and their vector versions. Special functions such as gr_gamma and gr_zeta return GR_UNABLE; use an arb_t ring for them. The constants gr_pi, gr_euler and gr_catalan are table lookups. Conversions with gr_set_other exist between the dfloat rings and from and to arb_t, acb_t, fmpz and fmpq; see Ball semantics, nonfinite values and domains for the rules on nonfinite values and status codes.
Guides#
The FLINT team, “gr_ctx_init_dfloat (dfloat.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/dfloat/gr_ctx_init_dfloat.html (generated 2026-10-20).
@misc{flint-doc-dfloat-gr-ctx-init-dfloat,
author = {{The FLINT team}},
title = {{gr\_ctx\_init\_dfloat (dfloat.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/dfloat/gr_ctx_init_dfloat.html},
note = {Generated 2026-10-20}
}