Rigorous numerical DFTs in fixed point
- Cost
- A transform in -limb fixed point costs the multiplications of the chosen algorithm, each word operations; the bounds cost double operations per plan. For the output error is ulp at an input scale of about .
Ball arithmetic [Hoe2009; Joh2017] gives rigorous results for any computation, but for a DFT it is wasteful: every operation propagates a radius, the radii grow with the depth of the transform, and each multiplication costs several floating-point operations. Since all roots of unity have modulus 1, the magnitudes in a DFT are easy to bound in advance, which makes fixed-point arithmetic a better fit. gr_dft runs transforms over two gr contexts of fixed-point numbers, computes a bound for every intermediate value and for the output error from the structure of the plan alone, and uses these bounds to produce enclosures for transforms of acb vectors (gr_dft_acb, which also implements acb_dft). For floating-point FFTs, error bounds of a similar kind are classical [Hig2002, ch. 24; Per2003].
Arithmetic#
With limbs of bits, a real fixed-point number is with an integer , so , and we write . A complex number is a pair of real ones. All error bounds below are in ulp and, for complex values, bound the modulus of the error unless stated otherwise.
Lemma 1 (Elementary operations). Addition, subtraction and negation are exact when the exact result has absolute value less than 1; otherwise the operation returns GR_UNABLE. A real product is truncated toward zero with error less than 1 ulp. A complex product has an error of at most ulp per part, with for , for (four real products) and for (three real products), hence of modulus at most .
The error of a real product is less than 1 ulp, but the analysis allows 2, which covers flint_mpn_mulhigh_n; for the products are exactly truncated, and a complex product combines two of them exactly. The three-product formula from 22 limbs computes with the sums held in an extra limb, so its imaginary part combines three rounded products. Overflow is detected from the carries, so a computation that returns GR_SUCCESS has kept every value in . The constants are not representable and are replaced by ; the transforms never multiply by them, since in complex mode the powers , of the root are applied by exchanging and negating parts.
The table of roots#
The plan's table holds approximations of . The primitive root is computed with arb at bits and truncated, with error at most 2 ulp per part. The entries up to (or , or , if or ) are computed as , and the others are exact copies with exchanged and negated parts, by the symmetries , and .
Proposition 2. Let bound the error of , with and . Then for all .
Proof. For both sides are 2. For , with and , induction gives .
The recurrence holds up to second-order terms, because and ; the implementation inflates the bound by a factor to cover them. The resulting bound for the whole table, about , is stored in the plan and is ulp. Sub-plans whose roots are powers of the parent root take strided copies of the parent table and its bound.
Propagating bounds through a plan#
The bound computation gr_dft_precomp_nfixed_bound follows the plan and tracks two numbers through the transform: a bound for the modulus of the current values and a bound for the modulus of their errors, in ulp. A running maximum, the peak, records the largest modulus reached by any input, intermediate or output value.
Lemma 3 (Rules). For values , with bounds , and a table root with error at most :
- has bounds ;
- the computed has bounds , if , and its computation involves values of modulus at most .
Proof. The first rule holds since additions are exact. For the second, , where up to second-order terms and , and the product adds a rounding error of modulus at most . The value bound is that of (the computed value is within ulp of it). In the two-multiplication classes , the intermediate values have modulus at most .
Every algorithm is a sequence of these steps, so its bounds are affine functions of the input bounds , and for recursive algorithms they are computed with memoised coefficients in operations on doubles, each inflated by a factor to cover the rounding of the doubles themselves.
Theorem 4 (Radix-2). For a radix-2 transform of length with inputs bounded by , the outputs are bounded by with , and the peak is at most .
Proof. Each level of Algorithm 1 of Discrete Fourier transforms over a generic ring doubles and (rule 1) and then multiplies by roots (rule 2, applied to all values for simplicity), so , which gives the claim by induction. The peak is reached inside the last rotations.
The other algorithms are handled in the same way: the split-radix recursion by memoised affine coefficients per depth, the direct prime kernel of Lemma 5 of Discrete Fourier transforms over a generic ring by bounding its differences of modulus and their rotations, the prime factor and four-step algorithms by composing the bounds of their sub-plans, and the naive algorithm as rotated terms. Since , the output error of a radix-2 transform is ulp for inputs of modulus about , compared with the relative error of a floating-point FFT with accurate roots [Hig2002, ch. 24]; the cost is a few guard bits per doubling of , about 3 in practice.
Remark 5. Computing each root to within 2 ulp, as is done over acb by a running product at a higher precision, would make constant and save about guard bits at the cost of a more expensive plan.
Bluestein's algorithm#
A generic bound on Bluestein's algorithm would be too weak: the inverse convolution transform doubles the bound at each of its levels, starting from values that are already times the input. Here the kernel is scaled by , so , and the values inside the inverse transform are bounded directly: each intermediate value of the unscaled inverse transform at level is times a sum of aliased values of the exact convolution , and . All intermediate values of the inverse transform are therefore at most , and the final doubling and chirp multiplication give outputs bounded by , as for any DFT. The errors follow the generic rules.
From bounds to enclosures#
The bounds are linear in , so for unit inputs the plan has a peak , and inputs of modulus less than cannot overflow. gr_dft_acb uses this as follows, for working precision .
- With , the input scale is , and is the output error bound for inputs bounded by with errors of 1 ulp (the truncation of the input).
- The number of limbs is the least with and , so that the roundoff is below relative to the largest input.
- For an input whose midpoint parts are less than in absolute value, the midpoints are multiplied by , , truncated to limbs and transformed. The outputs are multiplied by , rounded to bits, and get the radius plus their rounding error, where is the sum of all input radii.
Theorem 6 (Input radii). If for all , then the transforms of and differ by at most in every entry, for the forward transform and the inverse transform without division by .
Proof. , since .
The output therefore contains the exact transform of every point of the input balls: the transform of the midpoints is within the roundoff bound, and moving from the midpoints to any point of the balls changes the result by at most . The bound is computed once with upward rounding, which is both cheaper and, for inputs with radii of similar size, sharper than propagating radii through levels of ball arithmetic. For the inverse transform, the radius is divided by , exactly by an exponent shift for powers of two and otherwise together with a single rounded division of each output midpoint.
Remark 7. Step 3 bounds each part of the scaled input by , so the modulus of a scaled input can be up to , while the bound is evaluated for modulus . This leaves the overflow analysis valid (the peak is at most ) and does not affect the error bounds of most algorithms, which do not depend on . For Bluestein's algorithm the error bound has a term proportional to (the error of the kernel times the values it multiplies), and evaluating it at increases by 4 to 10 percent for between 101 and 4099. The bounds are pessimistic by much larger factors in practice, but the proof requires the modulus.
Referenced from#
References#
- [Hoe2009] J. van der Hoeven, "Ball arithmetic", Technical Report, HAL 00432152 (2009), http://www.texmacs.org/joris/ball/ball-abs.html
- [Joh2017] F. Johansson. "Arb: efficient arbitrary-precision midpoint-radius interval arithmetic". IEEE Transactions on Computers, vol 66, issue 8, 2017, pp. 1281-1292. https://doi.org/10.1109/TC.2017.2690633
- [Hig2002] N. J. Higham. Accuracy and Stability of Numerical Algorithms, second edition, chapter 24 (The fast Fourier transform and applications). SIAM, 2002. https://doi.org/10.1137/1.9780898718027
- [Per2003] C. Percival. Rapid multiplication modulo the sum and difference of highly composite numbers. Mathematics of Computation 72 (2003), 387–395. https://doi.org/10.1090/S0025-5718-02-01419-9
The FLINT team, “Rigorous numerical DFTs in fixed point,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/algorithms/fft/fixed-point-dft.html (generated 2026-11-02).
@misc{flint-doc-algorithms-fft-fixed-point-dft,
author = {{The FLINT team}},
title = {{Rigorous numerical DFTs in fixed point}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/algorithms/fft/fixed-point-dft.html},
note = {Generated 2026-11-02}
}