Error propagation
- Cost
- Each bound costs O(1) operations on mag_t numbers.
A ball function evaluates its result at the midpoint of the input and adds to the radius a bound for the propagated error: how much the exact function can differ between the midpoint and any other point of the input ball. For a function and a ball , the task is to bound
in terms of and . Most bounds below increase with , so they are stated in terms of and applied with . The rounding error of the midpoint computation is added separately (see Representation of radii and midpoints). All bounds are evaluated with mag_t arithmetic, rounding upward, from upper bounds for the quantities that occur in numerators and lower bounds for those in denominators.
Arithmetic#
Addition is immediate: , so arb_add adds the radii.
Theorem 1 (Product). For ,
Proof. Expand and apply the triangle inequality.
The bound is attained for real numbers when all of have the same sign, so for real balls it is optimal up to rounding. arb_mul computes the radius with mag_fast_mul and mag_fast_addmul, using upper bounds of and obtained from the top 30 bits of the midpoints.
Theorem 2 (Quotient). For with ,
Proof. We have . The triangle inequality bounds the numerator by , and the reverse triangle inequality gives .
When is much smaller than , arb_div uses the simplified form
with the computed quotient in place of and a fixed factor for , which is valid when the relative accuracy of is more than 20 bits. For less accurate input it evaluates the quotient at the endpoints instead, which gives a tighter enclosure.
Roots#
Theorem 3 (Square root). For real , with ,
where the first inequality is an equality for (and the limit value is 0 when ).
Proof. Since the square root is concave, a perturbation of size changes it most when it is negative, so the error is at most with . For the second inequality we need . The right side is nonnegative on , and squaring turns the inequality into , that is, , which holds for .
Theorem 4 (Reciprocal square root). For real with ,
Proof. By the mean value theorem the difference is for some between and , where and is decreasing, so .
Theorem 5 (-th root). For and real with ,
Proof. By concavity the error is largest for , , and
using for . Finally .
Elementary functions#
The following bound is the general principle; the theorems after it are its sharp special cases.
Theorem 6 (Generic first-order bound). Let be differentiable on a neighbourhood of the segment from to (real or complex). Then
Proof. The first bound is the triangle inequality, the second the mean value inequality .
Theorem 7 (Exponential). For real : , with equality if .
Proof. For this is an identity. For , , since .
arb_exp therefore adds , computed with mag_expm1 and an upper bound for the computed , to the radius.
Theorem 8 (Logarithm). For real with ,
with equality if .
Proof. The logarithm is concave and increasing, so the largest change is for , where .
arb_log uses this bound with mag_log1p when the input has more than about 20 bits of relative accuracy, and otherwise evaluates at both endpoints with the mag_t logarithm bounds.
Theorem 9 (Sine and cosine). For real : , and the same holds for with in place of .
Proof. The bounds 2 and follow from Theorem 6. For the third, Taylor's theorem with the Lagrange remainder gives , and .
arb_sin_cos uses the third form, with bounded from an 8-bit table entry, which is much tighter than near the extrema of the sine. Wide balls (radius above about ) are instead handled by evaluating at the endpoints and locating the extrema in between (arb_sin_cos_wide).
Theorem 10 (Arctangent). For real ,
If , one may take . Exactly, if or , the difference equals up to the choice of sign.
Proof. The first statement is Theorem 6 with and the range of of length . If , every point between and has absolute value at least , which gives the monotone choice of . The exact form is the subtraction formula , valid when .
arb_atan uses , capped by , for accurate input and the endpoints otherwise.
Sums and series#
Many special functions are evaluated by truncating a series. The truncated sum is computed in ball arithmetic, and a bound for the tail is added to the radius. The following bounds are the most common.
Theorem 11 (Geometric bound). If for all and , then
Proof. Compare termwise with the geometric series .
Theorem 12 (Integral bound). If is nonnegative and decreasing on , then
Proof. For , ; sum over .
For example, mag_hurwitz_zeta_uiui bounds in this way, and mag_exp_tail uses the geometric bound for the exponential series: if , consecutive terms of decrease by a factor at most , so the tail is at most twice its first term.
For analytic functions, the coefficients can be bounded by Cauchy's integral formula. If is analytic on a neighbourhood of the disk , then
which gives the following two bounds.
Corollary 13 (Cauchy bounds). With , the coefficients satisfy , and for and ,
Proof. Bound the integrand by on a contour of length ; the tail bound is then Theorem 11 applied to .
The Euler-Maclaurin formula and its remainder bounds, used for the zeta function, are discussed in Zeta functions, polylogarithms and L-functions.
Use in FLINT#
arb_add,arb_sub,arb_mul,arb_addmuland their variants use the sum and Theorem 1;acb_mulapplies Theorem 1 to complex balls in rectangular form componentwise.arb_divandarb_invuse Theorem 2 or the endpoints.arb_sqrt,arb_rsqrtandarb_root_uiuse Theorem 3, Theorem 4 and Theorem 5.arb_exp,arb_log,arb_sin_cosandarb_atanuse the corresponding theorems, with endpoint evaluation for inaccurate input.- The tail bounds are implemented by
mag_geom_series,mag_exp_tail,mag_hurwitz_zeta_uiuiandmag_polylog_tail, and are used throughout arb_hypgeom, acb_hypgeom and the zeta function code.
void arb_sin_cos(arb_t s, arb_t c, const arb_t x, slong prec)Referenced from#
- Complex arithmetic
- Dot products of balls (algorithm)
- Ball arithmetic (overview)
- Elementary functions (algorithm)
- Arithmetic and precision
- arb.h (module)
- Ball arithmetic (overview)
The FLINT team, “Error propagation,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/algorithms/ball-arithmetic/error-propagation.html (generated 2026-11-02).
@misc{flint-doc-algorithms-ball-arithmetic-error-propagation,
author = {{The FLINT team}},
title = {{Error propagation}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/algorithms/ball-arithmetic/error-propagation.html},
note = {Generated 2026-11-02}
}