8. Interval Arithmetic

Every answer comes with a guarantee

What if every number carried a label that said "the true value is somewhere in here"? That's the premise of interval arithmetic: instead of representing a quantity as a single floating-point approximation, you represent it as a pair [lo, hi] and guarantee that the true value lies within those bounds. Every operation propagates and widens the bounds so the guarantee is never violated.

This sounds conservative — and it is. Intervals grow with every operation. But in exchange, you get something valuable: a rigorous certificate. When an interval computation finishes and the result is [2.99998, 3.00002], you know with certainty that the true mathematical answer is between those two numbers. No amount of floating-point luck or unluck can invalidate that claim.

Core Idea

An interval [lo, hi] represents a set of real numbers: every x with lo ≤ x ≤ hi. A computation with intervals produces an interval that contains all possible results — for all possible combinations of input values within their respective intervals.

Diagram

Interval on a Number Line

lo hi true value is guaranteed to lie in here 0.1 0.3
The interval [0.1, 0.3] on a number line. The shaded region is the set of all real numbers the true value might be. Every arithmetic operation produces a new interval that is guaranteed to contain the true result.

The width of an interval — hi minus lo — measures uncertainty. A zero-width interval is an exact value. A wide interval reflects either imprecise input data or accumulated rounding error over many operations.

Interval Operations

Each arithmetic operation produces the tightest interval guaranteed to contain all possible results.

Addition is the simplest case. If A = [a, b] and B = [c, d], then A + B = [a+c, b+d]. The minimum possible sum uses the two lower bounds; the maximum uses the two upper bounds.

Subtraction requires a subtlety: [a,b] − [c,d] = [a−d, b−c]. Subtracting a large value shrinks the result; the minimum is a minus the largest possible B value, and the maximum is b minus the smallest possible B value.

Multiplication is more complex because signs matter. For A = [a,b] and B = [c,d]:

Interval multiplication

Compute all four corner products:
  ac, ad, bc, bd

Result = [min(ac, ad, bc, bd), max(ac, ad, bc, bd)]

This handles all sign combinations: when both intervals straddle zero, all four products must be evaluated.

Diagram

Four-Corners Multiplication Diagram

Four-corners diagram for [a,b] × [c,d] a b A axis → d c B axis → a·c b·c a·d b·d result = [min, max] of all four products
To multiply two intervals, evaluate the product at all four corners of the (A, B) rectangle. The minimum corner product is the result's lower bound; the maximum is the upper bound. This correctly handles mixed-sign intervals.

Division A / B = A × [1/b.hi, 1/b.lo], but only when B does not contain zero. If 0 ∈ [c, d], the result is unbounded or involves an extended interval covering (−∞, +∞), which most implementations flag as an error or represent with special infinity values.

Interval operation examples

[1, 3] + [2, 5] = [3, 8]
[1, 3] - [2, 5] = [1-5, 3-2] = [-4, 1]
[2, 4] × [3, 5] = [min(6,10,12,20), max(6,10,12,20)] = [6, 20]
[-1,2] × [3, 5] = [min(-3,-5,6,10), max(-3,-5,6,10)] = [-5, 10]
[2, 4] ÷ [2, 4] = [2×(1/4), 4×(1/2)] = [0.5, 2]

Directed Rounding

The rules above assume exact arithmetic. In floating-point, adding two lower bounds might introduce a rounding error that exceeds the true sum, breaking the guarantee.

The fix is directed rounding: compute lower bounds with round-down (round toward −∞) and upper bounds with round-up (round toward +∞). If the floating-point lower bound rounds down and the upper bound rounds up, the resulting interval is guaranteed to contain the exact result.

Why directed rounding matters

Exact:   0.1 + 0.2 = 0.3

Round-nearest (IEEE 754 default): lo = round_nearest(0.1 + 0.2) = 0.30000000000000004 // might be slightly above 0.3! → No longer a lower bound guarantee!

Directed rounding: lo = round_down(0.1 + 0.2) = 0.29999999999999998 // safely below 0.3 hi = round_up(0.1 + 0.2) = 0.30000000000000004 // safely above 0.3 → Guaranteed: 0.3 ∈ [0.29999999999999998, 0.30000000000000004] ✓

IEEE 754 mandates support for all four rounding modes (round-nearest, round-up, round-down, round-toward-zero), and most hardware can switch modes at runtime via a floating-point control register. Interval arithmetic libraries exploit this to produce rigorous bounds.

The Dependency Problem

Interval arithmetic has a well-known weakness: it treats each occurrence of a variable as an independent interval, even if all occurrences refer to the same value.

Consider x − x, where x ∈ [1, 3]:

The dependency problem: x − x

x ∈ [1, 3]

Mathematically: x − x = 0 for every x

Interval arithmetic: [1,3] − [1,3] = [1−3, 3−1] = [−2, 2]

The result should be exactly [0, 0] — but interval arithmetic returns [−2, 2] because it treats the two occurrences of x as if they could independently take any value in [1, 3].

Diagram

The Dependency Problem: x − x

0 true result: x − x = 0 −2 +2 interval result: [−2, 2]
The dependency problem. The true result of x − x is always exactly zero (teal dot), but interval arithmetic produces [−2, 2] (red bar) because it treats the two x's as independent variables. The interval is correct — it does contain 0 — but needlessly wide.

This widening is called overestimation. The interval result is always valid (it contains the true answer), but it may be far wider than necessary when a variable appears multiple times. A computation that rewrites x − x to 0 before passing it to interval arithmetic would get a tight result; one that evaluates it symbolically would not.

The problem scales with expression complexity. In a long formula where x appears ten times, interval arithmetic may produce a result hundreds of times wider than the true range.

Affine Arithmetic

Affine arithmetic is a partial fix for the dependency problem. Instead of representing a quantity as [lo, hi], it represents it as a linear combination of symbolic error terms:

Affine form

x̂ = x₀ + x₁ε₁ + x₂ε₂ + ... + xₙεₙ

where each εᵢ ∈ [−1, 1] is a symbolic noise symbol and x₀ is the central value and xᵢ are the coefficients (sensitivities)

Each noise symbol corresponds to a source of uncertainty — an input variable or a rounding error. Because variables share noise symbols, correlated cancellations are tracked.

For the x − x example, both occurrences of x share the same noise symbol ε₁. When you subtract them, the ε₁ terms cancel exactly, giving the correct result of 0 + 0ε₁ = 0.

Affine arithmetic handles linear dependencies exactly. It still overestimates for nonlinear operations (like multiplying two affine forms together — that introduces a new independent noise term), but performs significantly better than naive interval arithmetic in practice.

Applications

Verified numerics. The INTLAB and Julia IntervalArithmetic.jl packages use directed-rounding intervals to provide rigorous error bounds on numerical computations. A simulation can report "the answer is 1.7320508 ± 10⁻⁷" with a mathematical guarantee.

Computer graphics. Ray-box and ray-triangle intersection tests can use interval arithmetic to handle degenerate cases (rays that nearly-graze an edge) robustly, avoiding NaN and sign-error failures that plague naive floating-point implementations.

Global optimization. Branch-and-bound optimizers use interval arithmetic to certify that no part of the search space can contain a better solution than the current best, enabling rigorous global optima rather than just local minima.

Proof assistants. Systems like Coq and Lean can discharge numerical goals ("1.4142 < √2 < 1.4143") by running an interval arithmetic computation and checking that the result is entirely within the claimed bound.

The Guarantee Is the Point

Interval arithmetic is not primarily a tool for getting precise answers. It's a tool for getting certified answers. The result interval may be wide, but it is never wrong. In safety-critical systems — aerospace, medical devices, formal verification — that guarantee is worth the conservatism.

Key Takeaways

  • Interval arithmetic represents every value as [lo, hi] and guarantees the true value lies within
  • Addition widens both sides; subtraction flips the second interval; multiplication takes the min/max of four corner products
  • Directed rounding (round-down for lo, round-up for hi) makes the guarantee rigorous in floating-point
  • The dependency problem causes overestimation when a variable appears multiple times in a formula
  • Affine arithmetic tracks linear correlations between variables, recovering tightness for many common cases
  • Applications include verified numerics, robust geometric intersection, global optimization, and formal proofs

Try It Yourself — Interval Arithmetic Calculator

Enter two intervals and an operation. The result interval is displayed on a number line, showing how bounds propagate. Toggle the comparison to see how a naive floating-point midpoint calculation compares.

[ , ]
[ , ]