The vector that hides it
Worth reading first: The order they are added in · The same program, twice · Cancellation takes the answer, not a digit.
Three essays have argued from a vector that was built to argue from. A reader is owed the obvious question: does anything real look like that?
The answer is that the site has been computing sums like that for nineteen fields, and the ones that look nothing like it are the ones nobody makes a decision from.
Sixteen orders of magnitude between the top and the bottom of one figure, and the ordering is the argument.
The two at the bottom
rᵀr, a residual norm: κ = 1 exactly. Every term is a square, so no term can cancel another, and Σ|xᵢ| is Σxᵢ. There is nothing for a reduction order to disagree about beyond the last bit, and two machines summing this will agree to fourteen digits whatever they do.
pᵀAp, a curvature: κ = 4.1·10². A quadratic form in a positive definite matrix is positive, but its entrywise terms are not — the cross terms pᵢAᵢⱼpⱼ have both signs and cancel — so κ is a few hundred rather than one. Still small.
Those two are exactly the quantities the conjugate gradient method computes at every step. It is worth pausing on that, because it explains why the effect is so rarely noticed by people who work with iterative solvers every day: the method’s scalars are among the best-conditioned sums in the subject, and the disagreement they produce is a few hundred ulps rather than a few million. It is still enough to move an iteration count, which is what a stopping test is a race measures — but it is not enough to make anybody suspect the arithmetic.
The three at the top
A component of b − Ax: κ = 1.0·10¹⁷. The definition of a residual is a difference of two nearly equal things, so its terms cancel by construction, and the more accurate the answer the worse the cancellation. A residual of a converged solve is the worst-conditioned sum in the subject, and it gets worse as the solve gets better.
An orthogonality check qᵢᵀqⱼ: κ = 7.4·10¹⁵. Two orthonormal columns have an inner product of zero, so the terms sum to nothing at all while each is of size 1/n. The number the check returns is made entirely of rounding, and how much of it is made of which rounding is what a partitioning decides. Orthogonal is a number is the essay that turns the adjective into ‖QᵀQ − I‖; this is the observation that the number is one no two machines will agree about, and that the site’s own figures of it would move between builds if anything downstream of them were a comparison.
A nearly degenerate 2 × 2 determinant: κ = 3.6·10¹⁶. Two products of size 10¹⁶ whose difference is 1. One multiply the compiler removed follows that one all the way to its conclusion, which is that the answer is zero.
The reading
Sort the six by κ and the sorted list is very nearly a list of how the number is used.
The two well-conditioned sums are quantities that get reported: a residual norm goes into a convergence history, a curvature goes into a step length. Nobody compares either with a threshold in a way that changes the shape of an answer — a step length that differs in its eleventh digit gives a slightly different iterate, and the method carries on.
The three ill-conditioned sums are quantities that get compared. Is this residual below the tolerance? Is this inner product small enough to call the columns orthogonal? Is this determinant positive? Every one of them is a real number on its way to becoming a verdict, and every one of them is a sum whose value two machines will disagree about in its leading digits.
That is not a coincidence and it is not bad luck. A quantity is worth comparing with a threshold precisely when it is nearly zero, and a sum is ill conditioned precisely when it is nearly zero relative to its terms. The two conditions are the same condition. The reductions a program makes decisions from are, as a class, the reductions whose value is least well determined.
What this does to a benchmark
The immediate practical consequence is about measurement rather than about arithmetic, and it is the reason this effect has a reputation as a curiosity.
Run the hero experiment of the same program, twice on 4,096 positive numbers: the seven partitionings agree to a relative 1.6·10⁻¹⁵. Five of them still return distinct values — nothing about positive data makes addition associative — but the disagreement is at the last bit and no reasonable person would call it a problem.
Run it on a vector with κ = 10¹⁰ and the disagreement is 4.9·10⁻⁷, which is three hundred million times larger.
A demonstration that draws its data from a uniform generator, or a benchmark that sums a vector of times, or a tutorial that adds up the first million integers, is a demonstration on the left-hand end of that range. It will show a discrepancy of one or two ulps, which reads as a rounding curiosity, and the reader will conclude that the phenomenon is real and unimportant. The counterexample this essay’s refusal is built on is exactly that vector: the assertion positive data disagrees with itself is fed 4,096 positive numbers and must reject.
Where else the site has been quietly living with it
Reading the census backwards through the collection turns up several places where a number this site publishes is one whose reproducibility was never checked. Naming them is more useful than not.
Every ‖QᵀQ − I‖ on the site. The orthogonality figures are the site’s signature measurement, and they are computed from inner products with κ ≈ 10¹⁶. The values drawn are stable because this site’s builds are serial and seeded — a seeded generator is what makes a figure byte-identical between builds — but a reader reproducing them in a threaded environment should expect the leading digits to move.
Every residual norm quoted at the rounding level. A figure that reports ‖PA − LU‖/‖A‖ = 4.49·10⁻¹⁶ is reporting a number whose own leading digits are a property of the reduction that computed it. The order of the residual is a fact about the factorisation; its digits are not.
Every trace estimate. The census puts zᵀAz at κ = 42, which is mild — but the choice of probe is a decision already shows that the variance across probes swamps everything, so the reduction order is not the dominant term there. It is worth knowing which term dominates rather than assuming.
None of that invalidates a figure. It qualifies a claim: a residual at 10⁻¹⁶ is a residual at 10⁻¹⁶, and its third digit belongs to the machine.
The census is not a ranking of difficulty
A tempting misreading is that the six are ordered by how hard they are to compute. They are not. Every one of them is a single loop, and the two at the top are the shortest — a 2 × 2 determinant is two products. What the census orders is how much of each answer is made of rounding, which is a question about the data and not about the work.
That distinction matters because it decides where an intervention goes. Making a hard computation easier is an algorithmic question and this site has nineteen fields of them. Making an ill-conditioned sum better conditioned is not available at all: κ is a property of the multiset, and no reordering, no compensation and no wider float changes it. What those buy is a smaller error against the same κ, which is a different and more modest thing.
So there are exactly three moves, and the field’s remaining essays are about the second and third:
- change the data — compute a different quantity whose sum does not cancel, which is what forming rᵀr instead of Σrᵢ does and why the residual norm is at the bottom of the census while the residual component is at the top;
- change the arithmetic — compensate, or accumulate exactly, which shrinks the error against a κ that has not moved;
- change the summation — make it order-independent, which does not shrink the error at all and makes the answer the same everywhere.
The third is the one this field is here for, and it is the one with no entry in the standard vocabulary, because the vocabulary was built for the first two.
A sum this site could not have written before
One entry in the census deserves its own paragraph, because it is the reason the census is a measurement rather than a list.
The residual component sits at κ = 1.0·10¹⁷, which is above 1/u. A summation condition number larger than the reciprocal of the unit roundoff means the computed sum has no correct digits at all in the worst case — the amplification exceeds what the format can carry. That is not a pathological construction: it is one row of b − Ax for a system with a condition number of 10¹⁰, which is an ordinary badly-scaled problem of the kind the condition number is an amplifier is about.
The reason it does not destroy anything in practice is that nobody uses that number on its own. It goes into a norm, and a norm is a sum of squares, and the squaring puts κ back to one. The subject’s habit of working in norms is doing more numerical work than it is usually given credit for, and the census is where that becomes visible: the aggregate is well conditioned and every one of its components is not.
Which is also the warning. A method that looks at residual components rather than at a norm — a componentwise stopping test, an entrywise backward error, a check for which equation is worst satisfied — is a method that has stepped from the bottom of this census to the top, and accuracy that is not a property of a method is the essay that argues those methods are the sharper ones. They are. They are also the ones whose answers two machines will disagree about.
Two things this does not say
It does not say ill-conditioned sums are wrong. Every one of the runs in the census is backward stable, and the residual with κ = 10¹⁷ is the exact residual of a nearby system. Cancellation exposes error that was already there, which is the reading cancellation takes the answer insists on and which is as true here as it is for a single subtraction.
And it does not say the ill-conditioned sums should be avoided. They are the sums worth computing. A residual is the most informative quantity a solver produces; an orthogonality check is the measurement this whole site is built on. The recommendation is not to stop computing them, it is to know that their reproducibility is not free — which is what the sum that cannot be wrong prices, and what what determinism costs puts a number on.
How to use the census
The operational version fits on a line: before worrying about reproducibility, compute κ of the sums involved. One pass, no estimator, no matrix.
If κ is near one, the arithmetic will agree between machines to the last bit or two, and any disagreement observed has another cause — a different library version, a different algorithm, a different problem — which is a much more useful thing to know than a vague suspicion of the hardware.
If κ is 10⁸ and the number is on its way to a comparison, the comparison is the thing to look at rather than the arithmetic, and the rest of this field is about what to do.
And if κ is 10¹⁶, the quantity is made of rounding and its leading digits are not a property of the problem at all. That is worth knowing before publishing them.
One last note on the census’s own honesty. Every κ in it is measured on a specific instance — one Q, one system, one probe — and κ is a property of a vector rather than of a kind of vector, so a different instance moves the numbers. What does not move is the ordering, and the ordering is what the essay is about: sums of squares at one, cross terms in the hundreds, differences of nearly equal things at 10¹⁵ and above. Those three bands come from the signs of the terms, and the signs of the terms are a property of what the quantity means.
That is the reason the census is worth having at all rather than a table of formulas: it is a measurement of the site’s own arithmetic, taken with the same instrument as everything else, and it would move if the site’s libraries changed underneath it.
The version of this to remember
Three sentences, and the third is the one that is not obvious.
A sum’s reproducibility is decided by its summation condition number — the total size of its terms divided by the size of its answer — and by nothing else about it: not its length, not its precision, not the number of workers it was divided across.
That number is exactly one for a sum of squares and above 10¹⁵ for a difference of nearly equal things, and it costs one pass to compute.
And the sums a program compares with a threshold are, as a class, the sums at the bad end — because a quantity is worth comparing with a threshold when it is nearly zero, and a sum is ill conditioned when it is nearly zero. The two conditions are the same condition, which is why this is a field and not a footnote.
At other settings
What links here
Computed from the collection, not written here: the essays that point at this one.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- A bound every answer satisfies — both name reduction order, summation condition number
- Buying the accuracy back — both name catastrophic cancellation, residual
- The fifth author — both name reduction order, residual
Named objects
A flat tag is an object no other essay names yet.
CancellationCatastrophic cancellationOrthogonality lossReduction orderResidualSummationSummation condition numberTrace estimation