The units that overflow before the answer does
Worth reading first: A norm that overflows before it is a norm · One exponent for thirty-two numbers · The units the matrix is measured in · A matrix that depends on its own eigenvalue.
A norm that overflows before it is a norm is about a vector whose length is perfectly representable and whose naive computation is not: sum the squares and the sum passes the format’s largest number long before the answer does. The repair is to factor out the largest entry first, and the loss without it is half the exponent range.
This essay is the same failure one level up, where the thing that overflows is not an intermediate in a norm but the problem itself, and where the consequence is not a wrong answer but the absence of one.
Where the γ² comes from
A quadratic eigenvalue problem (λ²M + λC + K)x = 0 can be written in any units of time. Replacing λ by γμ gives the coefficients (γ²M, γC, K), which is the same problem with the spectrum divided by γ — exactly, with nothing approximated. The scaling that buys ten orders is about choosing that γ well, and the previous essay in its field measures what a badly chosen one costs in accuracy.
The γ² is what this essay is about. A change of units that multiplies λ by a thousand multiplies M by a million, and a factor of a million in a coefficient is a factor of a million closer to the top of the format.
That is not a hypothetical. Mass in kilograms and stiffness in newtons per metre against mass in tonnes and stiffness in meganewtons per millimetre is a γ of 10⁶, which is a γ² of 10¹². Nobody doing it thinks they are doing arithmetic.
The boundary is a closed form
The condition is that γ² times the largest entry of M be representable, so the boundary is
γ* = √(largest finite value ÷ largest entry of M),
computed from the format’s own two parameters and one number from the problem. Measured against a sweep that rounds every entry to the format and asks whether any is infinite, the prediction is right at every stop of twelve:
| format | largest finite | boundary γ* |
|---|---|---|
| fp16 | 65504 | 256 |
| binary32 | 3.4·10³⁸ | 1.8·10¹⁹ |
| binary64 | 1.8·10³⁰⁸ | 1.3·10¹⁵⁴ |
Two routes to one number and neither of them measures anything about the answer: one is a formula from the exponent field and the bias, the other asks the arithmetic whether it can hold the entries. That is the same shape of check as the format constants are the hardware’s, where the same formula is verified against the two published constants everybody knows.
The significand does not appear
Look at the table again. The boundary moves with the exponent field and with nothing else: eleven bits of exponent buy 10¹⁵⁴ and five buy 256. The significand — the thing everybody means by “precision” — is not in the formula.
That is the other half of a format in its sharpest form. Range and precision are separately purchasable, tf32 and fp16 differ in exactly that trade, and this is a range question wearing the clothes of an accuracy one. A reader watching a quadratic lose digits as γ grows would reasonably reach for more significand; more significand does not move this boundary by a single decade.
The pair of eight-bit formats makes it starker still. E5M2 has five exponent bits and E4M3 has four, and their largest finite values are 57344 and 448 — so the boundary for the same problem is a factor of eleven apart between two formats of the same width, decided entirely by how the byte was split. Eight bits, and a format that breaks the rules is about that split; this is what it costs when the number being held is a coefficient rather than a value.
Past the boundary there is no answer
The distinction worth being precise about: past γ* the failure is not a loss of accuracy.
The entries of γ²M round to infinity. The linearisation built from them contains infinities. The factorisation of a matrix containing an infinity produces NaNs, and a NaN compared against anything is false, so the pivoting logic takes an arbitrary branch and the routine returns numbers that are not related to the problem at all — or does not return.
That is a different failure mode from everything else in this field, and it belongs to a family this site has already met once: the zero that is written on purpose is about a quantity that becomes exactly zero rather than small, and the arithmetic downstream then does something categorical rather than inaccurate. An infinity is the same event at the other end of the range. A badly scaled problem in binary64 returns plausible eigenvalues that are wrong in the third digit; a badly scaled problem in binary32 past 10¹⁹ returns nothing usable, and there is no residual to be small because there is no answer to take a residual of.
There is a mercy in that, and it is worth naming: the loud failure is the better one. The quiet one — a backward-stable answer to a problem nobody asked — is the one that ships.
And the scaling never fails
The second row of the figure is the same question after Fan–Lin–Van Dooren scaling, and it is yes at every stop of every format.
The reason is immediate once written down: the scaled coefficients are δγ²M, δγC and δK with γ = √(‖K‖/‖M‖) and δ = 2/(‖K‖ + γ‖C‖), and those three have norms of about one whatever the original γ was. The scaling does not reduce the entries a little; it removes the dependence on the units entirely.
So in a narrow format the two lines are not an accuracy device. They are what makes the problem exist, and a code that does its arithmetic in binary32 — which is most codes that run on a graphics processor — has no version of the computation available without them.
The trap inside the repair
Which brings the essay back to its ancestor, with a sharper consequence than that one had.
γ is computed from ‖K‖ and ‖M‖. A naive Frobenius norm sums squares, so it overflows at the square root of the format’s largest value — and the quantity it is computing is the input to the very scaling that would have prevented the overflow.
Measured in binary32, on the entries of a stiffness matrix scaled up by powers of ten:
| scale | true norm | naive route | scaled route |
|---|---|---|---|
| 10¹⁸ | 5.8·10¹⁸ | 5.8·10¹⁸ | 5.8·10¹⁸ |
| 10¹⁹ | 5.8·10¹⁹ | infinity | 5.8·10¹⁹ |
| 10²² | 5.8·10²² | infinity | 5.8·10²² |
The true norms are comfortably inside binary32’s range — the format holds numbers up to 3.4·10³⁸ — and the naive computation of them is not. Three of six stops fail, and every one of the failures is at a scale where the answer is representable.
float.js’s scaled norm, which factors out the largest entry before summing, returns all of them
correctly. It is the same repair the vector essay recommends, and here it is load-bearing rather
than tidy: without it a code that scales cannot compute its own scaling exactly where the scaling
is what is needed.
What else scales like a square
The γ² is not the only place a change of units enters quadratically, and the family is worth naming because the same boundary formula applies to each.
A degree-d matrix polynomial scales its leading coefficient by γ^d. A cubic — which arises from a three-term delay approximation, or from a structure with a rate-dependent damper — reaches the same boundary at the cube root of the same number: in binary32, γ* falls from 1.8·10¹⁹ to 7·10¹², and in fp16 from 256 to 40. Higher degree, tighter bound, and the same two lines to remove it.
A normal-equations formation squares the matrix rather than the units, which is the road that squares the problem — there the square is in the condition number and here it is in the exponent, but a code that forms AᵀA in binary32 on a matrix with entries near 10²⁰ has the same failure for the same arithmetic reason.
And a Gram matrix in a Krylov method does the same thing to the basis vectors. The safeguard is identical in all three cases: measure the norm before forming anything, with a routine that cannot overflow while computing it.
Where the limit actually binds
It is fair to ask whether any of this is reachable in binary64, where γ* is 1.3·10¹⁵⁴.
For the change of units alone, no. Nobody has a unit conversion of 10¹⁵⁴, and the accuracy failure of the previous essay arrives at γ = 10⁸ — forty-six orders of magnitude earlier. In binary64 the overflow boundary is a curiosity.
In binary32 it is 1.8·10¹⁹, and the accuracy failure arrives at about 10⁴ because there are only eight digits to lose. So in binary32 the two failures are fifteen orders apart and again the accuracy one comes first.
In fp16 the boundary is 256 and there are three digits to lose, so they arrive together. That is the case this essay exists for: a half-precision solve of a structural problem whose stiffness is in newtons and whose mass is in grams overflows before it is inaccurate, and the two failures are not distinguishable from the output. The measurement is what makes them distinguishable in advance, and the boundary is a closed form that costs one norm to evaluate — the same discipline where the box is cut applies to an interval method, and for the same reason: knowing where a representation runs out is cheaper than discovering it.
Two boundaries and which one a code hits
Putting the two failures on one axis is the practical summary, because a reader with a format and a problem wants to know which of them arrives first.
The accuracy failure arrives when the coefficient norms spread far enough that the significand runs out — measured in binary64 at about γ = 10⁴ for the first visible digit and γ = 10⁸ for all of them. That threshold moves with the significand: half as many bits, half as many decades of spread before every digit is gone.
The representability failure arrives at √(largest finite ÷ ‖M‖) and moves with the exponent.
So the two thresholds are governed by the two halves of the format, separately, and the gap between them is the format’s own asymmetry. Binary64 has a very long exponent and a moderate significand, so the accuracy failure comes first by forty-six orders. fp16 has neither, and they land together. The formats built for machine learning — bfloat16 above all, with binary32’s exponent and seven bits of significand — put them furthest apart in the other direction: an enormous range and almost no digits, so a quadratic in bfloat16 is inaccurate almost immediately and representable essentially forever.
Which is a sentence about a format’s design intent rather than about a bug. bfloat16 was built so that a gradient never overflows, and it does exactly that here too.
What to check before solving
Three numbers, none of which costs more than a norm:
The coefficient norms, computed safely. ‖M‖, ‖C‖, ‖K‖ by a scaled route. They are the input to everything below and to the scaling itself.
The representability margin. √(largest finite ÷ max|M|) against one, which says whether the problem as written can be formed in this format at all.
And the spread. max/min of the three norms, which says how many digits the units are costing. It is the diagnostic the previous field’s essay identifies as the only warning available, and it is free once the norms are in hand.
There is a fourth check that costs nothing and is worth naming separately, because it is the one that catches the case this essay is about rather than the case the previous one is: round the formed coefficients to the target format and ask whether every entry is still finite. It is one pass, it needs no analysis, and it distinguishes a problem that will be inaccurate from a problem that will not exist — which is the distinction the whole essay turns on and the one no residual reports.
Then scale, and none of the four matters any more. That is the point of a repair whose cost is three norms: the checks are worth running once to know what would have happened, and after that the problem no longer has the property they were checking for.
The general rule this is an instance of
Stated once, because it applies well beyond a quadratic eigenvalue problem.
Any change of variable that scales a coefficient by a power of the scaling multiplies the representability requirement by the same power. The exponent range is a budget, and a substitution that looks free in the algebra can spend all of it.
The three instances on this site are worth listing side by side. A vector norm computed naively spends half the exponent range on the squares. A normal-equations formation spends half of it on the products. A change of units in a degree-d polynomial spends a d-th of it on the leading coefficient. Each has the same repair — factor out the largest thing first — and each has the same trap, which is that the quantity needed to do the factoring is computed by the very operation that overflows.
The check is the same in all three cases and costs one pass over the data: measure the largest entry before forming anything. It is the cheapest instrument in this whole field, and it is the one that distinguishes a problem that will be inaccurate from a problem that will not exist.
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.
- Six routes to one spectrum — both name matrix polynomial, quadratic eigenvalue problem, scaling
Named objects
A flat tag is an object no other essay names yet.
Binary32Exponent rangeFp16hypotMatrix polynomialOverflowQuadratic eigenvalue problemScaling