FLINT3.7.0-dev

d1_canonicalise, d2_canonicalise, d3_canonicalise, d4_canonicalise, d1b_canonicalise, d2b_canonicalise, d3b_canonicalise, d4b_canonicalise

Synopsis#include <flint/dfloat.h>
void d1_canonicalise(d1_t res, d1_srcptr x)
void d2_canonicalise(d2_t res, d2_srcptr x)
void d3_canonicalise(d3_t res, d3_srcptr x)
void d4_canonicalise(d4_t res, d4_srcptr x)
void d1b_canonicalise(d1b_t res, d1b_srcptr x)
void d2b_canonicalise(d2b_t res, d2b_srcptr x)
void d3b_canonicalise(d3b_t res, d3b_srcptr x)
void d4b_canonicalise(d4b_t res, d4b_srcptr x)

Sets res to x (exactly, with the radius unchanged) with the components in canonical form: |x_{i+1}| \le \operatorname{ulp}(x_i)/2 and zeros only at the end, which is the form obtained by rounding the value to nearest term by term. Works for any x whose components overlap by at most a few bits, in particular any result of this module. A nonfinite head is copied as it is by dN_canonicalise; dNb_canonicalise gives the whole real line in its normal form.

The arithmetic renormalises with a single bottom-up pass (weak renormalisation), which is all the error analysis needs, but after a cancellation a component can be smaller than the one following it, so the representation is not unique and dN_equal compares values rather than components. For N = 2 the weak form is already canonical; for N = 3, 4 about 4 to 7% of the results of random operations are not. Canonicalisation is a top-down TwoSum chain with a check, and a branchy repair pass in about 10^{-5} to 10^{-4} of the cases.

Cite this page

The FLINT team, “d1_canonicalise, d2_canonicalise, d3_canonicalise, d4_canonicalise, d1b_canonicalise, d2b_canonicalise, d3b_canonicalise, d4b_canonicalise (dfloat.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/dfloat/d1_canonicalise.html (generated 2026-10-20).