FLINT3.7.0-dev

mp_real_set_dfloat, mp_real_get_dfloat

Synopsis#include <flint/mp_real.h>
void mp_real_set_dfloat(mp_real_t res, const double * x, slong n, double rad)source
void mp_real_get_dfloat(double * res, double * rad, slong n, const mp_real_t x)source

Convert from and to the double expansions of dfloat: arrays of n \le 8 doubles (the midpoint components) and a double radius. mp_real_set_dfloat sets res to the ball \sum_i x_i \pm \mathit{rad} and throws for nonfinite components or radius. mp_real_get_dfloat rounds x greedily to n doubles and sets rad (if not NULL) to a bound for the error and the radius of x.

The sum in mp_real_set_dfloat is exact, accumulated in a two's complement frame spanning the components' exponents, and the radius is installed as an ulp count, rounded up. In mp_real_get_dfloat each component is the double nearest to the remainder, so that |x_{i+1}| \le \operatorname{ulp}(x_i)/2; components that would be subnormal are not produced (their value goes to the radius), and a value beyond the double range gives dfloat's whole line, zero components with an infinite radius. Both conversions avoid arb_t.

Cite this page

The FLINT team, “mp_real_set_dfloat, mp_real_get_dfloat (mp_real.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/mp_real/mp_real_set_dfloat.html (generated 2026-10-20).