FLINT3.7.0-dev

gr_ctx_init_decfloat, gr_ctx_init_decball, gr_ctx_init_deccfloat, gr_ctx_init_deccball

Synopsis#include <flint/decimal.h>
void gr_ctx_init_decfloat(gr_ctx_t ctx, slong prec, int flags)source
void gr_ctx_init_decball(gr_ctx_t ctx, slong prec, int flags)source
void gr_ctx_init_deccfloat(gr_ctx_t ctx, slong prec, int flags)source
void gr_ctx_init_deccball(gr_ctx_t ctx, slong prec, int flags)source

Initializes ctx to the ring of decimal floating-point numbers, decimal balls, complex decimal floating-point numbers, respectively complex decimal balls, with default precision prec digits (at least 1) and the given flags. The default rounding mode is DECIMAL_RND_NEAR (for both real and imaginary parts) and the radius precision is DECMAG_DEFAULT_PREC digits. Exponents are unbounded. The largest possible limb radix is used.

Passing DECIMAL_PREC_EXACT as the precision gives the exact ring \mathbb{Z}[1/10] of decimal fractions: no rounding is ever performed, and inexact operations (division by 3, square roots of non-squares) return GR_UNABLE. Additions of operands whose exponents are astronomically far apart also return GR_UNABLE in this mode rather than allocating huge mantissas.

Guides#

Cite this page

The FLINT team, “gr_ctx_init_decfloat, gr_ctx_init_decball, gr_ctx_init_deccfloat, gr_ctx_init_deccball (decimal.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/decimal/gr_ctx_init_decfloat.html (generated 2026-10-20).