FLINT3.7.0-dev
Overview

Floating-point arithmetic in FLINT

FLINT has several floating-point types, which differ in their radix, their precision range, their memory layout, and whether they carry rigorous error bounds. They are not alternatives for the same job so much as layers: arbitrary-precision balls for rigorous numerics, fixed-size types for speed in the generic algorithms, and limb- or double-level kernels on which the others are built.

The types#

TypeModuleRadix and precisionError controlGeneric ring
arf_t, acf_tarf, acfbinary, any number of bitsnone (exact or rounded with a rounding mode, like MPFR)gr_ctx_init_real_float_arf
arb_t, acb_tarb, acbbinary, any number of bitsrigorous balls with mag_t radiusgr_ctx_init_real_arb
nfloatnfloatbinary, 1 to 66 whole wordsnone (correctly rounded or within a few ulps; optional directed rounding)nfloat_ctx_init
mp_real_tmp_realradix 2^{64}, whole wordsrigorous balls, radius in ulps of the last wordnone (a backend)
decfloat_t, decball_tdecimalradix 10, any number of digitsrounded, or rigorous decimal ballsgr_ctx_init_decfloat, gr_ctx_init_decball
dN_t, dNb_tdfloatsums of 1 to 4 doubles (53 to 212 bits)none, or rigorous ballsgr_ctx_init_dfloat
double, di_tdouble_extras, d_vec, d_mat, double_interval53 bitsnone, or intervalsnone

All of them except the machine doubles have complex counterparts.

Arbitrary precision: arf and arb#

arf_t is FLINT's general binary floating-point type: the mantissa is stored inline for up to two words and on the heap beyond, the exponent is an fmpz (unbounded), and every operation takes a precision and a rounding mode. arb_t is a ball with an arf_t midpoint and a mag_t radius, and is the basis of FLINT's rigorous numerics (special functions, polynomial root isolation, integration). These are the types to use when precision must vary during a computation, exceeds a few thousand bits, or results must be certified; see Ball arithmetic.

Fixed precision for generic algorithms: nfloat#

nfloat numbers have a precision of n whole words, fixed by the context, and a bounded exponent. Elements are flat arrays of n + 2 words with no heap memory, so vectors and matrices are contiguous and each operation dispatches to a kernel for its size. Over gr_poly and gr_mat, approximate root-finding and linear solving run about twice as fast as over arf_t or MPFR [Joh2025gr]. Results are not certified, but directed rounding contexts give bounds for the arithmetic, dot products and elementary functions. See Fixed-precision floating point with nfloat.

Limb-level kernels and balls: mp_real#

mp_real provides multiple-precision arithmetic in radix 2^{64} at two levels: fixed-point numbers on word arrays, and balls mp_real_t whose radius is counted in units of the last word. It is the backend for evaluating elementary functions, constants and hypergeometric series quickly at any precision: the nfloat elementary functions run on its fixed-point kernels. See Ball arithmetic with limb-granular radii, Elementary functions in mp_real, Multi-prime argument reduction, Binary splitting of hypergeometric series in mp_real and Constants in mp_real.

Decimal arithmetic#

The decimal module provides floating-point numbers and balls in radix 10, with precision measured in decimal digits and mantissas stored in words of radix 10^{19}, so that decimal input and output and decimal rounding are exact. It is the right choice when decimal inputs must be represented without conversion error or results must be correctly rounded to a number of decimal digits; binary types are faster otherwise. See Decimal floating-point arithmetic.

Machine doubles and their extensions: dfloat#

dfloat represents numbers as unevaluated sums of 1 to 4 doubles, with plain formats (approximate, like double) and ball formats with a double radius (rigorous). All operations are built from double arithmetic and fused multiply-adds, with SIMD for vectors, so that at 53 to 106 bits they are several times faster than nfloat and arb_t. The balls track every rounding error exactly, so exact operations stay exact. They are used for the main sums of the Riemann–Siegel and Platt methods for the zeta function. See Double-word and multi-double arithmetic and Elementary functions in double-word to quad-double precision.

The plain double helpers (double_extras, d_vec, d_mat) and the interval type di_t of double_interval are small support modules, used for heuristics, tuning and cheap bounds inside other algorithms; see Interval arithmetic with doubles.

Which to use#

NeedType
Certified results, special functions, any precisionarb_t, acb_t
Certified results at 53 to 212 bits, elementary functions, vectorsdfloat balls (d2b, d3b, ...)
Fast approximate linear algebra or root-finding at 64 to 4224 bitsnfloat
Fast approximate arithmetic at 53 to 212 bitsdfloat plain formats
Precision varying during the computation, or above 4224 bitsarf_t
Exact decimal roundingdecimal
Writing new limb-level numerical kernelsmp_real

Speed comparisons are described in Performance of dfloat (which also includes nfloat and arb_t); the nfloat speedups over arf_t are discussed in [Joh2025gr].

Referenced from#

References#

Cite this page

The FLINT team, “Floating-point arithmetic in FLINT,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/algorithms/floating-point/overview.html (generated 2026-10-20).