The arithmetic underneath

An octave to land in

A window read off a chain's own rates kept an eight-bit recurrence exact to sixty octaves, and its width, falling towards zero, was predicted to mark where it would stop being exact, to within an octave. It stops two to seven octaves earlier, as soon as the window is narrower than the octave a power-of-two rescale moves by. The rule that aims every step, predicted to outlast it, fails too, once the value it aims at no longer fits. A window computed for each step separately never narrows below 4.8 octaves, reproduces the unbounded exponent on every depth at which the format can still store the chain, and makes the fewest rescales of the three.

Worth reading first: The numbers below the smallest one · One exponent for thirty-two numbers · A ranking that is an eigenvector.

Room for the step, not the value carried an eight-bit recurrence with an integer beside each stored value, so that the value could be moved by an exact power of two whenever it neared an edge of the format, and found that the right thing to watch was not the value but the operation about to be done to it. The recurrence is detailed balance on a two-well birth–death chain, πi+1=πi pi/qi\pi_{i+1} = \pi_i\,p_i/q_i, each product and quotient rounded to the format. A window read off the chain’s stored rates — no lower than the smallest normal number divided by the smallest pp, so that no product falls into the subnormal band, and no higher than the largest normal times the smallest qq over twice the largest pp, so that no quotient passes the top — reproduced the same significand with no exponent limit, bit for bit, on all 531 runs of every format to sixty octaves of barrier.

The window narrowed as the barrier deepened, and on the shortest chain in E4M3 its width was falling about a fifth of an octave for every octave of barrier. The essay extrapolated and made a prediction with a sign: the 32-state line “meets zero near 67 octaves”, and “the window rule’s runs stop reproducing the unbounded exponent at the depth where the computed width first goes negative, to within one octave, and the aiming rule’s do not — a chain built past sixty octaves is the test.”

The chain can be built to 120 octaves without changing anything else, so the test is direct. Both halves of the prediction fail, and the way they fail says what a rescaling rule actually needs from the format.

Chains past sixty octaves

The chains are the ones the well on the far side of the band built: a double well sin⁡2(πs)\sin^2(\pi s) with a slight tilt, Metropolis rates with proposal one half, a temperature chosen so the top of the barrier is 2−d2^{-d} of the near well, and the rates stored in E4M3 before anything is computed. Five lengths, from 32 to 64 states, and every whole depth from two to 120 octaves. The comparison is the strict one: a rescaled run either reproduces the unbounded route — the same four significant bits with no limit on the exponent — entry for entry, or it does not.

Past sixty octaves something happens to the chain that did not happen before it, and it has to be read before any rule is. E4M3’s smallest normal number is 2−62^{-6}, and its subnormals go down to 2−92^{-9} in steps of 2−92^{-9} — the band that eight bits, and a format that breaks the rules measured at three octaves wide. A deeper barrier on the same number of states means steeper steps, and the uphill rates fall with them: on the 32-state chain the smallest stored pp is 2−72^{-7} at sixty octaves, 2−82^{-8} at 68, 2−92^{-9} at 75. At 91 octaves a rate falls below half of 2−92^{-9} and is stored as zero. From there the chain in the format is a different chain — one with a wall in it — and no treatment of the exponent can compute a far well the stored rates have cut off. On 40 states the same happens at 115 octaves; on 48, 56 and 64 it does not happen inside 120.

That is the last limit, and it belongs to the data rather than to the arithmetic. Every rule below is judged on the depths before it.

Where each way of rescaling a two-well chain's stationary vector stops being exact in E4M3, against the barrier depth to 120 octaves, beside the limits read off each chain's own stored rates32 states: window under an octave from 63, below zero from 68; the window rule first fails at 66 and the aiming rule at 69; a stored rate is zero from 91; the window per step reproduces the unbounded exponent at every depth before that. 40 states: window under an octave from 79, below zero from 85; the window rule first fails at 81 and the aiming rule at 92; a stored rate is zero from 115; the window per step reproduces the unbounded exponent at every depth before that. 48 states: window under an octave from 95, below zero from 103; the window rule first fails at 96 and the aiming rule at 108; a stored rate is zero from none inside 120; the window per step reproduces the unbounded exponent at every depth before that. 56 states: window under an octave from 111, below zero from 120; the window rule first fails at 115 and the aiming rule at none inside 120; a stored rate is zero from none inside 120; the window per step reproduces the unbounded exponent at every depth before that. 64 states: window under an octave from none inside 120, below zero from none inside 120; the window rule first fails at none inside 120 and the aiming rule at none inside 120; a stored rate is zero from none inside 120; the window per step reproduces the unbounded exponent at every depth before that.020406080100120barrier depth, octaves32 statesa rate is zero from 9140 statesa rate is zero from 11548 states56 states64 stateswindow under one octavewindow width below zerothe window rule first failsthe aiming rule first failsthe window per step: exacta stored rate is zeroE4M3, five chain lengths, every depth from 2 to 120a window needs an octave to hold a power of two
Fig. 1 Each E4M3 chain’s limits read off its own rates — where its one window is narrower than an octave, where its width goes below zero, where a stored rate is zero — beside the first depth at which the window rule and the aiming rule stop reproducing the unbounded exponent. The bar is the window per step, which reproduces it at every depth the chain is stored at.

The figure at the top of the page is the whole result in one place. On every chain where the window closes inside 120 octaves, the window rule’s first failure, the blue dot, sits to the left of the dashed line where the width goes negative and to the right of the dotted line where it falls under one octave. The aiming rule’s first failure, the violet dot, is never far from the dashed line either, on one side or the other. And the pale bar, the third rule, runs unbroken to the end of every chain.

A width that is still positive

The window rule fails first at 66 octaves on 32 states, 81 on 40, 96 on 48 and 115 on 56. The width goes below zero at 68, 85, 103 and 120. So the rule stops being exact two, four, seven and five octaves before the depth the prediction named, outside its tolerance of one on every chain. At the depth where each first fails, the window still has 0.39, 0.39, 0.71 and 0.39 octaves of room in it.

The width of the one window an exponent counter can hold an E4M3 value in, against the barrier depth to 120 octaves, for five chain lengths, with the depth at which the window rule first stops being exact ringed32 states: 1.39 octaves at 60, under one from 63, below zero from 68; the rule first fails at 66, where the width is 0.39; 40 states: 3.71 octaves at 60, under one from 79, below zero from 85; the rule first fails at 81, where the width is 0.39; 48 states: 5.13 octaves at 60, under one from 95, below zero from 103; the rule first fails at 96, where the width is 0.71; 56 states: 6.41 octaves at 60, under one from 111, below zero from 120; the rule first fails at 115, where the width is 0.39. The width falls in steps because the stored rates are E4M3 numbers. On 64 states it stays above one octave to 120.first failure, octaves of room left32 states: width where the rule fails0.3940 states: width where the rule fails0.3948 states: width where the rule fails0.7156 states: width where the rule fails0.39020406080100120-4-20246810121416barrier depth, octaveswindow width, octaves32 states40 states48 states56 statesdashed: zero width · dotted: one octave · rings: the rule's first failurethe rule fails above zero
Fig. 2 The width of the one window, in octaves, against the barrier depth to 120, for the four chain lengths on which it closes. The dashed line is zero width and the dotted line one octave; the rings mark where the window rule first stops being exact. The width falls in steps because the rates are E4M3 numbers.

The reason is in what a rescale is allowed to do. It multiplies the stored value by 2k2^k for an integer kk and adds kk to the counter, which is what makes it exact: a normal number times a power of two is the same significand with a different exponent. But it means the value can only be moved in whole octaves. A window narrower than an octave need not contain any of the positions a given value can be moved to. The value vv and the window [ℓ,h][\ell, h] fix the value’s position within its octave, and if that position falls outside the window’s fraction of the octave, no integer kk puts v⋅2kv \cdot 2^k inside.

The first failure on 32 states is exactly that. At 66 octaves the window runs from 2.67 to 3.5. The value arriving at the seventh state is 2.5, below the window. The rule computes the shift that brings it nearest the window’s geometric middle, which is zero octaves — doubling it would give 5, further from the middle than 2.5 is and outside the window on the other side. So the value stays at 2.5 and meets the steepest descent step of the chain, whose stored pp is 3⋅2−93 \cdot 2^{-9}. The exact product is 7.5⋅2−97.5 \cdot 2^{-9}, a sixteenth below the smallest normal, and the band’s grid is 2−92^{-9} wide, so it rounds to 2−62^{-6}. With no exponent limit, 7.5⋅2−97.5 \cdot 2^{-9} is 1.875⋅2−71.875 \cdot 2^{-7}, which four significant bits hold exactly. The two runs differ from the seventh state on.

The general statement is short. A window guarantees exactness for every value inside it, and a rule built on it guarantees exactness only if it can always put the value inside. With moves in whole octaves that needs an octave of room, not a positive width. The dotted line at one octave is where the guarantee lapses: 63 octaves on 32 states, 79 on 40, 95 on 48, 111 on 56. Every first failure sits between that line and the zero line, which is the measurement saying the width that matters is one, not zero.

Past the first failure, a coin

A guarantee lapsing is not the same thing as a computation failing, and past its first failure the window rule is neither exact nor wrong in any steady way. On the 32-state chain it fails on 20 of the 25 depths from 66 to 90 and reproduces the unbounded exponent on the other five — at 67, 68, 72, 73 and 74 octaves, three of them past the depth at which its width is negative.

The value an exponent counter starts each step from in E4M3, along a 32-state chain with a barrier 76 octaves deep: one window for the whole chain against a window for each stepThe single window read off the chain's rates is -2.19 octaves wide at this depth, which is no window at all; under it the counter makes 30 rescales, 4 products fall below E4M3's smallest normal and 0 quotients reach 448, and the far well is wrong by 26.3 per cent where the unbounded exponent is wrong by 7.2. The window for each step, shaded, runs from the smallest normal over that step's p to the largest normal times its q over twice its p; under it the counter makes 22 rescales and reproduces the unbounded exponent exactly, wrong by 7.2 per cent.E4M3, 32 states, 76 octavesone window: width, octaves-2.2one window: far-well error0.26a window a step: far-well error0.072048121620242832-10-8-6-4-20246810state along the chainstored value, power of twolargest normalsmallest normalone windowa window a stepeach step's starting value · shaded: its own window · rings: a product in the banda step suits itself
Fig. 3 The value each step starts from along the 32-state E4M3 chain under one window (red) and under a window computed for each step (green), as a power of two. The shaded region is each step’s own window; rings mark products that fell into the subnormal band. The dashed lines are E4M3’s smallest and largest normal numbers. The dial sets the barrier’s depth.

The dial shows why a negative width is not fatal everywhere. The one window is a single interval that must suit every step of the chain at once: its lower end is set by the smallest pp anywhere, which belongs to the steepest step on the way down into the barrier, and its upper end by the largest pp and the smallest qq, which belong to the gentle steps and the steepest step on the way up. Its width is the format’s range less those octaves: log⁡2(448)+6+log⁡2qmin⁡+log⁡2pmin⁡−log⁡2(2 pmax⁡)\log_2(448) + 6 + \log_2 q_{\min} + \log_2 p_{\min} - \log_2(2\,p_{\max}), with pmax⁡p_{\max} a half. No single step pairs those three rates. A value that sits a little outside the one window is usually still inside the window the next step actually needs, which is the shaded band.

So at 72 octaves the one window is 0.61 octaves negative and the rule is still exact. Four of its products even fall into the band there, and all four happen to lie on the band’s grid, which a product with few significant bits often does; the steps where the value sits outside the one window are mostly not the steps whose rates set its bounds. At 76 octaves, the dial’s second stop past the zero line, it is not: four products fall into the band, the far well comes out wrong by 26 per cent where the unbounded route is wrong by 7.2. At 84 octaves the window is 3.2 octaves negative, the rule’s lower end is above its upper end, and every step rescales the value to the same place — the flat red line — which is the right place for no step in particular. Six products fall into the band and four quotients reach 448, and the far well is wrong by 88 per cent.

One more thing the dial shows, at 66 octaves: a run that is not exact is not necessarily a worse run. The single product rounded on the band’s grid at the seventh state happens to move the far well towards the double-precision answer, and the far well is wrong by one per cent where the unbounded route, and the step rule with it, are wrong by twenty. That is luck, in the same sense that the far well in a byte warned against reading a survival count that had been passed by a different sequence of roundings: the reference here is the unbounded exponent, and the only claim a rescaling rule can make is to reproduce it.

The aim needs room above

The second half of the prediction was that the aiming rule would not close. It rescales before every step so that the product pivp_i v lies between one and two, and the previous essay said it “needs only that each rate and each rate’s reciprocal is representable”. Read literally, that is true. What it misses is where the rule puts the value in order to aim the product.

To put pivp_i v between one and two the rule sets vv between 1/pi1/p_i and 2/pi2/p_i. On the steepest descent step of a deep chain, pip_i is a few times 2−92^{-9}, and 2/pi2/p_i is several hundred. E4M3’s largest normal number is 448. Once twice some rate’s reciprocal passes 448, there are steps on which the value the rule aims for does not fit, and the rescale that was meant to be exact saturates instead. That happens at 68 octaves on 32 states, 85 on 40, 103 on 48, and 120 on 56 — by coincidence of how these chains’ rates fall, the same depths at which the one window’s width goes negative.

The aiming rule’s first failures follow it: 69 octaves on 32 states, 92 on 40, 108 on 48, and none inside 120 on 56. On the shortest chain it fails three octaves after the window rule does. It is not a gentler failure either: once its rescale saturates, the counter records a power of two that was not applied in full, and every later entry inherits the difference.

The far well's relative error along a 32-state E4M3 chain at every barrier depth from 2 to 90 octaves, under three rescaling rules, the window per step being the unbounded exponent's own errorBelow 66 octaves all three reproduce the unbounded exponent entry for entry. The far well is lost — wrong by half or more — at 16 of the 89 depths when the counter aims every step, at 9 under one window and at 0 under a window per step, whose error is the unbounded exponent's at every depth. From 91 octaves a stored rate is zero and no rule has a chain to compute.E4M3, 32 states, 89 depthsaim every step: depths lost16one window: depths lost9a window a step: depths lost0010203040506070809010⁻⁴10⁻³10⁻²10⁻¹1barrier depth, octavesfar well, relative erroraim every stepone windowa window a stepdashed: wrong by half · floored at 10⁻⁴past the closing, the step rule alone is exact
Fig. 4 The far well’s relative error along the 32-state E4M3 chain at every depth the chain is stored at, under the aiming rule, one window, and a window per step. The dashed line is the half at which a far well counts as lost. The window per step’s error is the unbounded exponent’s error at every depth.

Below 66 octaves the three lines are one line, because all three rules reproduce the unbounded route. Past it they separate. Over the 89 depths at which the 32-state chain is stored, the aiming rule loses the far well on 16 and the one window on nine. The aiming rule’s losses are the worse: from 80 octaves on its far well is wrong by more than ninety per cent, because the value it saturates is the value at the bottom of the barrier, and the whole far well is assembled from what is carried out of it.

That the aiming rule is the worse of the two inverts the earlier ranking, and the inversion is the instructive part. Aiming was the rule that could not miss the band, and it does not: no product of an aiming run ever falls below the smallest normal. It fails at the top, exactly as the floor rule failed at the top on the climb out of a sixty-octave barrier — and for the same reason, a placement that leaves no room for the operation’s reach. Holding the product at one pins the value at the reciprocal of the rate, and the reciprocal of a small rate is a large number in a format whose largest number is 448. A norm that overflows before it is a norm made the same mistake impossible by keeping room for the square rather than for the value; aiming keeps room for the product and none for the quotient.

A window for each step

The repair follows from both failures. The one window has to suit every step at once; the aiming rule suits one step but chooses a position without regard to the format’s top. What each step needs is a window of its own: vv no lower than the smallest normal over pip_i, so that this step’s product is normal, and no higher than the largest normal times qiq_i over 2pi2p_i, so that this step’s quotient stays an octave clear of the top — intersected with the format itself. Before each step the rule checks the value against that step’s window and rescales to its middle only when the value is outside.

The width of the step’s window is the format’s normal range less one octave, plus log⁡2qi\log_2 q_i. The smallest rate E4M3 can store that is not zero is 2−92^{-9}, so no step’s window is ever narrower than 14.8−1−9=4.814.8 - 1 - 9 = 4.8 octaves, which is far more than the one octave a rescale needs to land in. Measured, the narrowest step window on any chain is 4.81 octaves, on 32, 40 and 48 states alike, because all three reach a rate of 2−92^{-9}.

That makes the rule’s guarantee unconditional on everything except the chain’s storage. It reproduces the unbounded exponent on every depth of every length at which no stored rate is zero — 89 depths on 32 states, 113 on 40, 119 on the others — and on E5M2 and half precision on every depth to 120, where nothing closes at all. On the 32-state chain it keeps the far well at every depth to 90 octaves, wrong by at most 26 per cent, which is the four bits’ own error and the same error the unbounded route makes. The numbers below the smallest one opened this question with a format whose band was worth a few octaves; with a window per step, the band is never visited.

The exact rule is also the cheapest

How many exact power-of-two rescales each rule makes along an E4M3 chain, averaged over every barrier depth at which the chain is stored, for five chain lengths32 states: aiming 26.8, one window 19.2, a window a step 12.6; 40 states: aiming 33.8, one window 24.4, a window a step 16.2; 48 states: aiming 39.8, one window 26.9, a window a step 17.3; 56 states: aiming 45.4, one window 27.7, a window a step 17.7; 64 states: aiming 50.7, one window 27.8, a window a step 17.3. The window per step is the cheapest of the three on every length and the only one exact on every depth.0102030405032 states26.819.212.631 steps40 states33.824.416.239 steps48 states39.826.917.347 steps56 states45.427.717.755 steps64 states50.727.817.363 stepsaim every stepone windowa window a stepmean rescales along the chain, every stored depth to 120 octavesrescales per run; the comparison is made every step under every rulethe exact rule is also the cheapest
Fig. 5 Mean rescales per run under each rule, over every depth at which the chain is stored, for the five chain lengths. The window per step makes the fewest on every length.

It would be reasonable to expect exactness at every step to cost a rescale at every step, as the aiming rule’s does. It costs less than the other two rules. On 32 states the window per step averages 12.6 rescales a run against 19.2 for the one window and 26.8 for aiming; on 64 states 17.3 against 27.8 and 50.7. The aiming rule rescales almost every step because it insists on one position. The one window rescales more often as it narrows, because a narrow window is left by any step of more than its own width, and past its closing it rescales every step to a point that suits none. The window per step is wide everywhere and only acts when a step is about to go wrong.

Every rule makes one comparison a step, so the comparisons are the same price. What the step window adds is its two bounds per step, which can be computed once from the stored rates before the recurrence starts and kept beside them: two more numbers a rate, in a computation whose rates are already an array. That is a storage cost the one window does not pay, and it is the only one.

What the closing was made of

Three limits were folded into the earlier essay’s extrapolated sixty-seven octaves, and they come apart once the chain is built.

The first is the rule’s resolution. A rescale moves in octaves, so any rule that holds a value in an interval needs the interval to be an octave wide, and the one window reaches that width two to seven octaves before it reaches zero. This is the same lesson as a bit buys an octave read the other way round: there a shared exponent’s resolution was set by the significand, here a counter’s is set by the integer it adds.

The second is the rule’s choice of position. A window shared by every step is set by rates that never meet in one step, and a position aimed at one operand ignores the other. Neither is a limit of the format; both are limits of the rule, in the sense the units that overflow before the answer does meant when it found an intermediate needing more range than its result.

The third is the format’s, and it is the only one left with a window per step. E4M3 cannot store a rate below half of 2−92^{-9}, and a chain steep enough to need one has a stored zero in it. Past that depth the question is no longer how to compute the stationary vector of the chain but whether the chain has been stored at all. What a float can hold drew the format’s numbers; the last of them is where this computation ends.

What 559 chains do not show

Five chain lengths and 119 depths are 595 runs a rule; without the depths at which a rate is zero, 559 remain, and every one is a single chain of a single shape. The rates of a double well are smooth along the chain, so neighbouring steps have similar windows and a value rescaled into one step’s window is rarely far outside the next one. A recurrence whose multipliers jump from step to step would make the step window rescale more often, though its guarantee — four octaves of room per step at the least, whatever the rates — is a statement about each step separately and does not depend on smoothness. The coincidence of the aiming rule’s room with the one window’s zero is a property of these chains, not a theorem, and the count of rescales is an average over depths and so weighted toward the deep, steep chains where every rule works hardest.

Still open: rates with an exponent of their own, a block that shares one, and a certificate in a byte

A counter for the rates. With a window per step the chain’s own storage is the only limit left, and it is the same kind of limit the value had: a rate below the band is lost because it has no exponent to spare. Storing each rate as a significand and an integer, as the value is stored, removes it. The prediction with a sign is that a 32-state chain carried that way reproduces the unbounded exponent on every depth to 120 octaves, that its far well is lost only where the unbounded route loses it — on no more than three depths in a hundred — so that the depth at which E4M3 can carry this chain is set by its four bits alone and not by any exponent, the value’s or the rates’.

One exponent shared by a block. The previous essay’s first question is still unasked, and one exponent for thirty-two numbers is where the shared exponent was first priced. With the step window as the rule, a shared exponent for a block of bb consecutive states needs one value of kk that lands every state of the block in its own step’s window. The windows are 4.8 octaves wide at the least and the states inside a block span up to about 5b5b octaves on the steep part of a 32-state chain, so the prediction is that blocks of two keep exactness on every depth and blocks of four lose it from about the depth where the steepest four steps span more than 4.8 octaves together.

A certificate in a byte. The componentwise backward error of an E4M3 run with a counter is a statement about a computation whose only error is its four bits. Whether that number can tell a far well wrong by eight per cent from one wrong by a quarter — the range this page’s unbounded runs span — decides whether such a vector can be shipped with any statement of its accuracy, and it is now the only one of the three questions this chain has asked four times without an answer.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

Dynamic rangeExponent rangeFp8OverflowScalingSignificandSilent failureStationary distributionSubnormal numbers