Mathematics · Article
Floating-point arithmetic and round-off
Finite binary formats, rounding and range, cancellation, error bounds, fused and compensated algorithms, conversion, mixed precision, stochastic rounding and rigorous certificates through complete exact examples.
Back to MathematicsAfter reading, you can
- Derive finite binary formats, spacing, subnormal values, unit round-off and nearest or directed rounding from an explicit representation.
- Separate data uncertainty, conversion, arithmetic error, conditioning and execution assumptions, including range limits and exceptional values.
- Prove finite examples and scoped error bounds for cancellation, summation, dot products, Horner evaluation and fused operations.
- Follow error-free sum and product transformations and compensated summation while retaining ordering and representability conditions.
- Explain decimal round trips, double rounding, scaling, mixed precision and stochastic rounding through full exact calculations.
- Construct outward interval and residual certificates, preserving units and the distinction between proof, reproducibility and implementation evidence.
Exact targets and finite calculations
Exact mathematics describes objects independently of a computer representation. A calculation stores selected finite values and rounds intermediate results according to a specified rule. A measurement adds another layer: its uncertainty existed before arithmetic began. Understanding round-off means tracing these layers carefully enough to say which quantity an error bound actually concerns.
This lesson uses explicit binary toy formats and the stated parameters of binary64 to derive the arithmetic, rather than inferring the behavior of an unspecified device or programming language. Unless a section says otherwise, nearest rounding means ties to an even significand, and each stated operation rounds once in the declared format. Range assumptions, gradual underflow, fusion and evaluation order are always part of the claim. Named general theorems are distinguished from the exact examples and proofs supplied here.
Earlier algebra, calculus and linear algebra provide exact identities, derivatives, sums and norms. Here those objects become targets for finite computation, connecting scientific measurement, engineering tolerances and numerical work in computing and AI. Complete worked examples and exercises cover both ordinary calculations and boundary failures. The following numerical lessons can then study stability and approximation using a precise arithmetic model.
Exact data, measurements and arithmetic error
A numerical calculation starts with a mathematical data model. An exact written decimal such as 0.1 denotes the rational number 1/10 unless a different meaning is specified. A measurement written with the same digits may instead denote a stipulated interval or a probability model. Storing either in a finite binary format is another operation. Measurement uncertainty, input conversion and arithmetic rounding are different errors and should not be combined by changing the target after the calculation.
For a real target x and a computed value xhat, absolute error is |xhat-x|. If x has physical units, this absolute error has those units. Relative error |xhat-x|/|x| is dimensionless when x is nonzero; at x=0 that quotient is not a useful definition. An ulp describes the local spacing of a particular numerical format, not the uncertainty of an instrument or a universal real unit. Changing a physical unit changes the absolute scale but not the exact dimensionless relative comparison.
Suppose the true input lies in a stipulated interval and a chosen central value is converted before arithmetic. A deterministic error budget can use the triangle inequality to separate the error of the arithmetic on the stored data, the conversion error and the effect of changing the mathematical input within its allowed interval. A derivative or another proved sensitivity bound is needed for that last effect. Adding variances instead would require a stated statistical model and its dependence assumptions; it does not follow from the existence of round-off.
The computational contract therefore names the input target, finite format, rounding rules, range behavior and evaluation order. Exact fractions or integer encodings can certify particular calculations once that contract is fixed. A short display, a small residual or agreement between two rounded computations does not by itself certify the original real-data problem. The purpose is to preserve what each number means as it moves between mathematics, storage and arithmetic. For the distinction between represented operands, prior data and rigorous enclosures, see [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html); [Verification methods: Rigorous results using floating-point arithmetic](https://www.tuhh.de/ti3/rump/intlab/ActaNumerica2010.pdf).
Finite radix formats
Fix an integer radix beta≥2, a precision p≥2 and integer exponent limits emin≤emax. A nonzero positive normal value has the form m beta^(e-p+1), where beta^(p-1)≤m≤beta^p-1 is an integer and emin≤e≤emax. A negative normal value is its negative. Equivalently, the normalized significand m/beta^(p-1) lies in [1,beta) and has p radix digits, including its leading digit. Precision counts the whole significand, not only an explicitly stored fractional field.
The least positive normal value is mu=beta^emin. The largest finite normal value is (beta-beta^(1-p)) beta^emax, obtained by taking the largest significand and exponent. Increasing the exponent by one while dividing an allowed significand by beta does not create a duplicate normal representation, because the smaller significand would fall below its normalized lower bound. Thus these normal representations give distinct positive values. Their number is (emax-emin+1)(beta-1) beta^(p-1).
Gradual underflow adds values k eta for 1≤k<beta^(p-1), with eta=beta^(emin-p+1), as well as zero. These are the positive subnormals. They fill a constant-spacing grid below mu but use fewer effective significant digits near zero. The same smallest quantum eta also divides every finite normal value: m beta^(e-p+1)=m beta^(e-emin) eta. This integer-grid fact will help explain exact tiny differences, even though normal spacing grows with magnitude.
A bit encoding may contain more distinctions than the real value set. In the specified IEEE-shaped binary toy examples, an all-zero exponent field selects zero or subnormals, interior exponent fields select normals, and an all-one exponent field selects infinities or NaNs. Positive and negative zero have distinct encodings but the same ordinary real value. A count of encodings must retain that distinction, and a count of NaN payload encodings is not a count of ordinary real numbers. Actual implementation behavior is a further contract to verify. For format definitions and parameter tables, see [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF); [Mixed Precision Algorithms in Numerical Linear Algebra](https://eprints.maths.manchester.ac.uk/2849/1/paper_eprint.pdf).
Which rational numbers are exactly representable
Write a rational number as a/b in lowest terms, with b>0. A finite radix-beta expansion exists exactly when b divides some power beta^k. In one direction, a finite expansion is an integer divided by beta^k, so reducing it can leave only a divisor of that denominator. Conversely, if b divides beta^k, multiply a/b by beta^k to obtain an integer and place the radix point k positions from its right edge. Sign and an integer part do not change the denominator argument.
Equivalently, every prime divisor of b must divide beta. This formulation matters for a composite radix: the denominator need not itself be a literal power of beta. In binary, after reduction it must be a power of two. Hence 1/8 and 5/32 have finite binary expansions, while 1/10,3/10,7/20,1/3 and 1/5 do not. A decimal expansion that looks short is not a proof of a short binary expansion, and an infinite repeating expansion can still denote a perfectly exact rational number.
This criterion concerns an unlimited finite expansion, not membership in one bounded format. A permitted denominator may require more than p significant radix digits, or an exponent outside the normal/subnormal range. For example an integer can have a long binary expansion even though its denominator is one. Trailing radix zeros can be shifted into an exponent, so the number of nonredundant significand digits, not just the written string length, controls the precision requirement. Subnormals have their own fixed quantum and reduced effective precision.
A stored binary value is itself an exact rational number. Its error arises when it is used as an approximation to a different target such as 1/10. Printing that stored value as the short decimal 0.1 can be a useful round-trip notation without making the two rationals equal. Conversely, expanding every stored rational into many decimal places changes its display, not its information content. Exact conversion analysis must compare the two rational values under a specified rounding rule. For positional representation and conversion context, see [Verification methods: Rigorous results using floating-point arithmetic](https://www.tuhh.de/ti3/rump/intlab/ActaNumerica2010.pdf); [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html).
Spacing, binades and unit round-off
Within the positive binade [beta^e,beta^(e+1)), consecutive normal values differ by h_e=beta^(e-p+1), because their integer significands differ by one. Moving to the next binade multiplies this spacing by beta. The precision therefore gives an approximately relative scale of resolution, not one constant absolute spacing across the entire number line. In the subnormal interval the spacing instead remains eta.
At an interior power beta^e the predecessor is beta^e-beta^(e-p), while the successor is beta^e+beta^(e-p+1). The gap below is h_e/beta and the gap above is h_e. This asymmetry is visible at one in binary precision four: the preceding value is 15/16, while the next is 9/8. A statement about half an ulp at a binade boundary must specify the applicable adjacent interval rather than impose a fictitious symmetric grid.
Assume one and its successor are normal values in range. Their distance, often called machine epsilon in an explicit definition, is epsilon=beta^(1-p). Under nearest rounding the conventional unit round-off is u=epsilon/2. In binary precision p this is u=2^(-p), while the successor gap is 2^(1-p). Different authors or software interfaces can attach the word epsilon to different constants, so the displayed formula is the mathematical authority. Confusing the two produces a factor-of-two error in later bounds.
For a positive normal x in its binade, h_e/x≤beta^(1-p), with a smaller ratio toward the upper end. This is the local source of a uniform relative rounding estimate. A decimal-digit summary such as p log10(beta) is a rough information comparison; guarantees about converting or round-tripping every number require their own precise digit theorem. Precision, exponent range and printed decimal digits are different specifications. For binade spacing and precision conventions, see [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF); [Mixed Precision Algorithms in Numerical Linear Algebra](https://eprints.maths.manchester.ac.uk/2849/1/paper_eprint.pdf).
Nearest rounding and ties to even
Let a<b be adjacent finite values that bracket an exact real input x. Nearest rounding chooses a when x<(a+b)/2 and b when x>(a+b)/2. At equality a tie rule is needed. Binary ties to even chooses the endpoint with an even final significand integer, equivalently a zero last retained bit on the common aligned grid. The ordinary parity decision is made on the representation, not by asking whether the real value is an even integer.
In binary precision four near one, the endpoints 1 and 9/8 have significand integers 8 and 9. Their midpoint is 17/16, so ties to even returns 1. The next midpoint, between 9/8 and 5/4, is 19/16; now the significand integers are 9 and 10, and the result is 5/4. These are exact rational comparisons. A decimal approximation of the midpoint is unnecessary and could itself introduce the error one is trying to decide.
Whenever the bracketing interval is finite, the absolute nearest error is at most (b-a)/2. Exact representable inputs are fixed points, so applying the same rounding map again changes nothing. Negative inputs obey the reflected nearest rule, apart from an operational choice of zero sign. Ties to even avoids a systematic one-direction choice at successive midpoints, but that does not make every sequence of rounding errors statistically independent or unbiased for every input distribution.
Store one sign bit, three exponent bits of bias three, and three fraction bits. Nonzero middle exponents have an implicit leading one. At zero exponent the leading bit vanishes, giving gradual subnormals. At the all-one exponent the fraction distinguishes infinities and NaNs. At equal distances inspect the actual retained integer significands rather than the values’ signs.
| Quantity | Exact result |
|---|---|
| Least positive subnormal | 1/32 |
| Largest positive subnormal | 7/32 |
| Least positive normal | 1/4 |
| Largest finite | 15 |
| Unit round-off | 1/16 |
| Upward spacing at 1, downward gap | 1/8, 1/16 |
| Predecessor of 1 | 15/16 |
| Bracketing stored values | 1, 9/8 |
| Endpoint bit patterns | 0 011 000 and 0 011 001 |
| Significand integer parities | 8 and 9 |
| Nearest-even stored value | 1 |
| Signed rounding error | −1/16 |
Exact inputs and supporting calculations
| Parameter | Value |
|---|---|
| p | 4 |
| emin | -2 |
| emax | 3 |
| x | 17/16 |
| Category | Number of encodings |
|---|---|
| Normal | 96 |
| Nonzero subnormal | 14 |
| Signed zeros | 2 |
| Infinity | 2 |
| NaN | 14 |
| Total | 128 |
| Total finite encodings | 112 |
| Distinct finite numeric values | 111 |
At a binade transition the last value below and the first value above still form the relevant neighboring pair, with their actual gap. At the subnormal/normal transition they lie on the same eta grid. Overflow requires a separate range rule because an infinity is not an ordinary finite endpoint at a real distance. Likewise, composing different precision-rounding maps is not the same idempotence statement; a higher-precision intermediate can land exactly on a lower-precision midpoint. For nearest rounding and tie conventions, see [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF); [Stochastic Rounding: Implementation, Error Analysis, and Applications](https://eprints.maths.manchester.ac.uk/2843/1/cfhm22.pdf).
Directed rounding modes
With finite neighboring values available, downward rounding D(x) is the greatest representable value not exceeding x, and upward rounding U(x) is the least representable value not below x. Thus D(x)≤x≤U(x). Toward-zero rounding uses D(x) for positive x and U(x) for negative x. The sign matters: downward rounding a negative number moves it away from zero, whereas upward rounding moves it toward zero. Signed-zero operational details are additional to these real inequalities.
For adjacent a≤x≤b, each directed error is less than b-a except at an endpoint where it is zero. Nearest rounding has the stronger half-gap estimate. On a normal binade this gives the conventional directed relative bound beta^(1-p)=2u under the stated range assumptions, compared with u for nearest rounding. At a binade boundary one uses the actual adjacent gap, and near zero the normal relative statement must be replaced by an absolute subnormal estimate.
For x=11/10 in binary precision four, the neighboring values are 1 and 9/8. Nearest selects 9/8; downward and toward zero select 1; upward selects 9/8. For -11/10 the neighboring values are -9/8 and -1: downward selects -9/8, upward and toward zero select -1, and nearest selects -9/8. The reflected inequalities demonstrate why copying the positive toward-zero choice into a negative downward computation is wrong.
Directed rounding uses the exact ordering of the two endpoints. Nearest uses the two exact distances, with parity breaking a tie. Signed error is rounded value minus the original rational.
| Quantity | Exact result |
|---|---|
| Distances from lower and upper neighbors | 1/10, 1/40 |
| Endpoint significands | 8, 9 |
| Midpoint | No |
Exact inputs and supporting calculations
| Parameter | Value |
|---|---|
| p | 4 |
| x | 11/10 |
| Mode | Stored value | Signed error |
|---|---|---|
| Nearest ties-even | 9/8 | 1/40 |
| Downward | 1 | −1/10 |
| Upward | 9/8 | 1/40 |
| Toward zero | 1 | −1/10 |
Directed rounding can support a deterministic enclosure when it is applied to the correct exact operation and the input intervals and domains are already valid. It does not automatically account for uncertain input data or for a nonmonotone interval function. Overflow, underflow and exceptional endpoints need the corresponding extended-range contract. These requirements are part of the proof of an interval result, not details that can be replaced by selecting a small numerical tolerance. For directed rounding and reflection conventions, see [Stochastic Rounding: Implementation, Error Analysis, and Applications](https://eprints.maths.manchester.ac.uk/2843/1/cfhm22.pdf); [Verification methods: Rigorous results using floating-point arithmetic](https://www.tuhh.de/ti3/rump/intlab/ActaNumerica2010.pdf).
The normal relative-error model
Consider an exact nonzero real x whose magnitude lies between the least normal and largest finite values, with nearest rounding and no range failure. In its normal binade the gap is h_e, so |fl(x)-x|≤h_e/2. Since |x|≥beta^e, division gives |fl(x)-x|/|x|≤beta^(1-p)/2=u. Hence fl(x)=x(1+delta) for some |delta|≤u. The hypothesis concerns the exact unrounded x, not merely whether its rounded result happens to be normal.
There is a slightly sharper uniform nearest bound on this normal domain. On an interval [a,a+h], the error divided by x increases up to the midpoint on the lower side and decreases after it on the upper side. Its maximum is h/(2a+h). Among intervals in a normal binade the smallest a is beta^e, giving h/(2beta^e+h)=u/(1+u). The first midpoint attains this value. The simpler u bound is conventionally convenient and safely weaker; it is not an assertion that the sharper value is impossible.
For an operation on already stored operands, let z be its exact real result. If the specified operation is correctly rounded and z meets the same premises, the model reads fl(a operation b)=(a operation b)(1+delta). This is a statement about arithmetic on those floating operands, not about the original real data before conversion. At z=0 one can set delta=0 in the identity fl(0)=0, but there is no reason to form a relative-error quotient by zero.
The multiplicative model must not be used without checking its conditions. Tiny exact results may have relative error one, overflowing results may not be finite at all, and an elementary library function may have a different accuracy promise from the specified basic operation. Reassociation or fusion also changes which exact intermediate z is rounded. Later gamma bounds will explicitly retain the relevant range and evaluation assumptions instead of hiding those cases inside an unexplained delta. For the scoped nearest-rounding model and sharper normal-range bound, see [Stochastic Rounding: Implementation, Error Analysis, and Applications](https://eprints.maths.manchester.ac.uk/2843/1/cfhm22.pdf); [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF).
Gradual underflow and subnormals
With gradual underflow, values between zero and the least normal mu lie on the uniform grid k eta, where eta=beta^(emin-p+1). Nearest rounding therefore has absolute error at most eta/2 on this interval, including a midpoint tie. There is no analogous small uniform relative bound as x approaches zero: eta/4 rounds to zero and has relative error one, even though its absolute error is only eta/4. Losing relative precision here is a finite-grid effect, not a failure of the stated nearest rule.
On the combined normal and subnormal domain, excluding overflow, a convenient safe bound is |fl(x)-x|≤u|x|+eta/2. For normal-sized x the first term already bounds the error; for subnormal-sized x the second term already does. This mixed bound is deliberately not sharp everywhere. A proof that needs a purely multiplicative delta must either exclude problematic underflow or carry the additive term through its recurrence. Substituting the normal bound simply because the rounded answer is mu is invalid.
Every finite stored value is an integer multiple of eta in this model. Consequently the exact difference of two stored values, when its magnitude falls inside the subnormal grid range, is itself a representable grid point. Severe cancellation can therefore produce an exact tiny subtraction rather than an additional subtraction-rounding error. The original inputs may still be poor approximations to real data; exactness of their stored difference does not recover information already lost during conversion.
A different contract may flush a subnormal result to zero or replace a subnormal input by zero. For the exactly representable nonzero value eta, such a zero has absolute error eta, exceeding the gradual-underflow nearest bound eta/2. One cannot retain the old proof while silently changing this behavior. The mathematical analysis must say which contract it assumes, and a claim about actual software or hardware must verify that contract separately. Exception-flag behavior is another specification and is not inferred just from a small result. For gradual underflow and mixed absolute-relative models, see [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF); [Accurate Sum and Dot Product](https://www.tuhh.de/ti3/paper/rump/OgRuOi05.pdf).
Zero with a sign
A format with two signed-zero encodings still has only one ordinary real zero value. In the stated IEEE-style operational contract, numerical equality regards +0 and -0 as equal, but a sign-sensitive operation may retain their distinction. For example a reciprocal can return +infinity from +0 and -infinity from -0, consistent with different one-sided limiting directions. This is extended operational arithmetic, not a definition of ordinary real division by zero.
The distinction is useful when a small negative result underflows to -0 or when a branch-sensitive function must preserve a side of a cut. It is not a second real value that can be separated from zero by a positive distance. Accordingly both signed zeros have zero ordinary absolute difference from zero. An error estimate based only on a real norm will not describe their different sign-dependent operational effects.
Zero-result signs can depend on the operation, operand signs and rounding mode. One should not infer every addition or cancellation sign from the reciprocal example. Likewise, zero divided by zero belongs to an invalid-operation case rather than the nonzero-finite divided-by-zero case. A program that needs zero-sign behavior must verify its specific evaluation contract instead of assuming that a printed zero records all the relevant information.
Signed zero also illustrates the difference between a displayed decimal, a real value and an encoding. A display may suppress the sign or show -0, while numerical equality still succeeds. Preserving or inspecting the sign is a separate operation. This does not authorize comparisons of NaNs as ordinary numbers, nor does it make physical uncertainty directional merely because the stored zero has a sign. Those are different data and arithmetic questions. For signed-zero conventions and their operational context, see [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF); [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html).
Overflow and the exponent boundary
Overflow occurs at the large-magnitude boundary of a bounded exponent format. The largest positive finite value Fmax=(beta-beta^(1-p)) beta^emax is not infinity, and infinity is not its next real neighbor at a finite distance. To understand a nearest overflow threshold, first consider rounding with the same precision but an unbounded exponent, then apply the specified exponent-range rule. This separates significand rounding from the special value produced when the rounded exponent cannot be represented.
In the binary precision-four toy format with emax=3, Fmax=15 and the last normal gap is one. The ideal next value at the same precision is 16. The midpoint 15.5 rounds toward 16 by ties to even: the upper value has an even retained significand, while 15 has the odd significand 15. The exponent limit then yields positive infinity under the stated nearest overflow contract. A nearby exact value below the midpoint can instead round to 15. Infinity was not used as a real point in the midpoint comparison.
For a positive overflowing magnitude, toward-zero and downward contracts return the largest finite value, while upward returns positive infinity. For a negative magnitude the directed choices reflect with the sign. These special results have different error meanings: a finite saturated value can have a very large error, while no finite real relative-error model describes an infinite result. A small unit round-off by itself therefore says nothing about an algorithm whose intermediate values overflow.
The value result and the overflow or inexact status are separately specified. The exact threshold for a flag follows the adopted arithmetic standard and rounding rule, not merely a test that a real intermediate exceeded Fmax. Intermediate overflow can sometimes be avoided by scaling or fusion even when the final exact answer is finite. It can also expose a genuinely unrepresentable final result. Both cases need a range argument before the ordinary multiplicative rounding model is applied. For overflow, format limits and the historical exception framework, see [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF); [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html).
NaNs, exceptional operations and flags
Exceptional results need explicit cases. Under the stated IEEE-style value contract, a nonzero finite number divided by signed zero produces a signed infinity and a division-by-zero condition. Operations such as 0/0, infinity/infinity, zero times infinity and subtraction of equal-signed infinities instead have no ordinary extended-value answer and produce an invalid-operation NaN. Opposite-signed infinity subtraction is a different case. Restricting the operands in each statement avoids conflating every expression containing a zero or infinity.
A quiet NaN usually propagates an invalid or missing numerical value through specified arithmetic without becoming an ordinary real number. A signaling NaN has a different invalid-signaling role when the contract supports it. Sign bits and payloads are encoding data, and their precise propagation is not an ordinary algebraic identity. One cannot prove that two independent computations have the same useful result merely because both display NaN, or use an unspecified payload rule as a portable mathematical certificate.
Ordinary ordered comparisons treat NaN as unordered. In particular equality of a NaN with itself is false under this contract, as are ordered less-than and greater-than comparisons with it; inequality is true. Thus saying that every comparison with NaN is false would be wrong. A separate total-order predicate can impose an encoding order, but it is a different relation from ordinary real less-than. A stopping test that relies on an ordered comparison can therefore behave differently after a NaN appears.
Invalid, division by zero, overflow, underflow and inexact are distinct status categories. A flag may record a condition without acting like a language exception, while a trap or a high-level runtime can expose it differently. Underflow in particular is not synonymous with every exact small subnormal result. These operational details require the actual standard and implementation contract when an application claim is made. The mathematical format alone does not specify a programming language’s exception policy or the storage scope of its flags. For the historical NaN and exception discussion, with the contract limitations stated here, see [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html); [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF).
Correctly rounded operations and library scope
For a specified correctly rounded operation, compute its exact mathematical result from the represented inputs and then apply the chosen target-format rounding once. This is stronger than a vague assertion that the answer is approximately accurate. It fixes midpoint decisions and, with an appropriate range contract, determines the finite or exceptional result. The basic arithmetic and square-root assumptions in an example are stated individually rather than inferred for every function bearing a mathematical name.
The inputs to that exact operation are the stored values. If a mathematical decimal was already converted to a nearby binary rational, correct multiplication acts on that rational; it does not undo conversion. Similarly, correctly rounding a square root of a rounded sum is different from correctly rounding the square root of the original exact sum. Each assignment or fused operation determines a distinct exact intermediate and hence a distinct rounding location.
An elementary-function library might promise a bounded ulp error, a relative error on part of its domain, correct rounding in selected modes, or another accuracy level. Those contracts are not interchangeable. In particular a function that is within one ulp need not make the same tie choice as correct rounding, and composing several correctly rounded functions need not give the correctly rounded value of their composition. Constants and decimal parsing also need their own conversion assumptions.
A mathematical analysis can therefore use a clear hypothetical contract without claiming that every current platform implements it. A statement about actual hardware, a compiler or a library must verify the relevant format, precision, subnormal behavior, rounding mode and fusion or reassociation rules. This separation preserves the usefulness of the exact proofs while preventing a finite example or a familiar language expression from silently serving as an implementation guarantee. For specified operations, fused arithmetic and mixed execution models, see [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF); [Accurate Sum and Dot Product](https://www.tuhh.de/ti3/paper/rump/OgRuOi05.pdf); [Mixed Precision Algorithms in Numerical Linear Algebra](https://eprints.maths.manchester.ac.uk/2849/1/paper_eprint.pdf).
Lost additions and nonassociativity
Finite-format operations need not preserve real associativity. In the precision-four toy format, the spacing at eight is one. The exact value 8+1/2 is the midpoint between 8 and 9, and ties to even returns 8. Consequently fl(fl(8+1/2)-8)=0. In the other order, fl(8-8)=0 and adding the representable 1/2 gives 1/2. All values are in range; the discrepancy is a deterministic effect of the different rounding locations, not a random failure of arithmetic.
A lost addition is not necessarily a large relative error in the addition itself. Rounding 8.5 to 8 has relative error 1/17, smaller than u=1/16. Subtracting eight afterward exposes the lost half as the entire intended final answer. An accurate local relative bound can therefore coexist with a poor relative answer from a cancellation-prone expression. The exact final target and its evaluation path must be kept distinct.
Distributive rewriting can also change a rounded result. In the same toy format take a=3,b=1,c=1/16. Rounding b+c gives 1 by the midpoint rule, so fl(a fl(b+c))=3. Separately ab=3 and ac=3/16 are representable, including the small subnormal product. Their exact sum is 51/16, which rounds to 13/4. The real identity a(b+c)=ab+ac remains true; its two floating implementations are different algorithms.
The exact target is the small addend. The spacing at the large input depends on its exponent. After the first operation has rounded to the large number, an exact subtraction of that stored value cannot reconstruct discarded information. With the subtraction first, equal large inputs cancel exactly and the small exact operand remains.
| Quantity | Exact result |
|---|---|
| Format | p=4, e_min=−2, e_max=3, gradual underflow |
| Exact first sum | 17/2 |
| First bracket | 8, 9 |
| Neighbor distances | 1/2, 1/2 |
| First rounded sum | 8 |
| Signed first error | −1/2 |
| Left steps | RN(17/2)=8; RN(8−8)=0 |
| Right steps | RN(8−8)=+0; RN(0+1/2)=1/2 |
| Final signed errors | −1/2, 0 |
Exact inputs and supporting calculations
| Parameter | Value |
|---|---|
| p | 4 |
| big | 8 |
| small | 1/2 |
These examples do not prove that a particular order is always better, nor that a compiler may freely choose any order while preserving a promised strict contract. They show why an error proof must match the actual evaluation tree. A test that compares two source expressions must specify whether fusion, reassociation or extra precision is allowed. Later bounds measure possible error for stated trees, while individual exact examples reveal which permitted errors actually occur. For nonassociativity and the effect of summation order, see [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html); [The Accuracy of Floating Point Summation](https://nhigham.com/wp-content/uploads/2023/10/high93s.pdf).
Sterbenz exact subtraction
Sterbenz exact subtraction, in the binary setting used here, says that nonnegative finite floating values x and y with y/2≤x≤2y have an exactly representable difference, provided the format supports the needed gradual-underflow results and no exceptional range event intervenes. It is a theorem about represented inputs. If y=0 the inequalities force x=0, giving the trivial difference; otherwise interchange x and y as needed and reduce to y≤x≤2y. Negative differences follow by sign.
First suppose both inputs are normal and in the same binade. Write x=M q,y=N q with the common quantum q and p-bit positive integers M≥N. The integer M-N is smaller than 2^(p-1), so its product with q requires no more than p significant bits after normalization. If the inputs occupy adjacent binades, use the smaller-binade quantum and write x=2M q,y=N q. The ratio condition gives M≤N, so 0≤2M-N≤M<2^p. Again the difference has at most p significant bits.
The ratio condition allows no greater normal-binade separation. If normalization of the difference would cross the least-normal boundary, every finite operand is still an integer multiple of eta. A tiny difference on that grid is representable as a subnormal. When one input is subnormal, the same eta-grid argument applies near the first binade; the ratio restriction keeps the difference within the representable small range. This is why gradual underflow matters to the unqualified exact-tiny-result statement.
For example 9/8-1=1/8 is exact in the toy format, even though its result is smaller than either input. This does not say that subtracting rounded approximations recovers the original real-data difference. Exact real 17/16 first rounds to 1 in that format, so subtracting the stored value of 1 returns zero exactly while the original difference was 1/16. Nor may one replace nonnegative same-sign inputs by only a ratio of absolute magnitudes: opposite signs turn subtraction into addition and can require a new rounding. For Sterbenz’s lemma and exact subtraction conditions, see [Stochastic Rounding: Implementation, Error Analysis, and Applications](https://eprints.maths.manchester.ac.uk/2843/1/cfhm22.pdf); [The Accuracy of Floating Point Summation](https://nhigham.com/wp-content/uploads/2023/10/high93s.pdf).
Cancellation and data sensitivity
Let the real target be d=a-b, and suppose stored inputs are atilde=a+ea and btilde=b+eb. Their exact stored difference differs from d by ea-eb, so the deterministic absolute data-error bound is |ea|+|eb|. This bound needs no independence assumption. It can be loose if the errors are correlated, but it does not become smaller merely because the subsequent floating subtraction is exact.
If a and b are nonzero normal-domain inputs rounded with |ea|≤u|a| and |eb|≤u|b|, then the exact stored-difference error is at most u(|a|+|b|). For d≠0 the ratio kappa=(|a|+|b|)/|a-b| measures amplification relative to the target difference. When a and b nearly agree with the same sign, kappa can be large. At d=0 this relative quotient is not defined; the absolute statement remains meaningful.
If the stored subtraction also incurs a normal-domain relative error deltas with |deltas|≤u, write dhat=(d+ea-eb)(1+deltas). The triangle inequality gives |dhat-d|≤u|d|+(1+u)u(|a|+|b|), and hence relative error at most u+(1+u)u kappa when d≠0. Under Sterbenz exactness the subtraction term is absent and the simpler data bound u kappa remains. This explicitly separates input sensitivity from operation error.
Cancellation is therefore not automatically an inaccurate subtraction. It can reveal large preexisting relative input errors, or it can expose errors introduced by an unnecessarily cancellation-prone way of computing an otherwise well-conditioned function. A reformulation can help the latter situation without recovering uncertain physical data or curing an inherently sensitive problem. A tolerance near zero must use the appropriate absolute scale instead of claiming a uniformly small relative error. For cancellation and the separation of data error from arithmetic error, see [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html); [Verification methods: Rigorous results using floating-point arithmetic](https://www.tuhh.de/ti3/rump/intlab/ActaNumerica2010.pdf).
Rationalizing small differences
For real x≥-1, set f(x)=sqrt(1+x)-1. Multiplying by the conjugate gives f(x)=x/(sqrt(1+x)+1). The denominator is at least one on this domain, so the second expression is also valid at x=0 and at x=-1. This is an exact identity before rounding. It is not an instruction to divide by a rounded zero, and it does not change the mathematical function being evaluated.
Near x=0, an approximation to sqrt(1+x) can have a small absolute error while its subtraction from one has a large relative error compared with f(x), which is approximately x/2. The rationalized expression keeps x in the numerator instead of recovering it through a nearly canceling difference. Even if the rounded sum 1+x becomes one, the original representable x can still carry useful information into that numerator. This explains the mechanism without assuming every library square root has an unstated accuracy guarantee.
The real function itself is well-conditioned for small nonzero x in relative terms. Differentiation and x=(sqrt(1+x)-1)(sqrt(1+x)+1) give |x fprime(x)/f(x)|=(sqrt(1+x)+1)/(2sqrt(1+x)), tending to one as x tends to zero. The poor direct-expression relative answer is thus avoidable algorithmic cancellation in that regime. Near x=-1 the derivative and this condition factor diverge; rewriting does not remove the original function’s sensitivity there.
In the toy calculation x=1/16 makes fl(1+x)=1, so the direct expression returns zero, whereas the rationalized calculation returns 1/32. The exact target is positive and lies between 2/65 and 1/32: its denominator sqrt(17/16)+1 lies between 2 and 65/32. Thus the rationalized absolute error is less than 1/2080 and its relative error is less than 1/64, while the direct relative error is one. These are explicit rational bounds for that input, not a universal guarantee against overflow, underflow or inaccurate function evaluation. For cancellation-avoiding reformulation context, see [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html).
Quadratic roots with a stable numerator
Consider a x²+b x+c=0 with real coefficients and a≠0. If D=b²-4ac≥0, write s=sqrt(D) and choose sigma(b)=1 when b≥0 and -1 otherwise. Define q=-(b+sigma(b)s)/2. The two terms inside this numerator have the same sign or one is zero, so this expression avoids their direct subtraction. When q≠0, one root is q/a and the other is c/q. The first is a usual quadratic-formula branch; the second follows from the product of roots c/a.
The identities are exact before rounding. Substituting q into q²+bq+ac=0 verifies q/a as a root, and the product relation supplies the other without subtracting nearly equal quantities again. If c is small while b is substantial, the direct small-root numerator -b+sigma(b)s can lose most of its information, whereas c/q retains that information through division. This motivation does not claim that all coefficient or discriminant errors are small.
Branches must be assigned explicitly. If a=0 and b≠0 the problem is linear, with root -c/b. If a=b=0, either every real number is a solution when c=0 or none is when c≠0. For a≠0 and D<0 there are no real roots in this discussion. The chosen q is zero only when b=s=0, which forces c=0 and gives the double zero root. If c=0 but b≠0, the q formula instead works and returns the roots -b/a and zero. A repeated root with D=0 is retained rather than divided into two falsely distinct roots.
The discriminant itself can suffer cancellation or overflow, and very close roots can be intrinsically sensitive to coefficient changes. Scaling all coefficients by a common nonzero factor preserves exact roots but still needs an analysis of the scaled arithmetic. A fused operation can improve a particular discriminant evaluation without certifying every product or domain test. The signed-q rearrangement solves one avoidable numerator-cancellation problem; a complete root certificate also needs valid range, sign and error bounds for D and the divisions. For the quadratic-formula cancellation example, see [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html).
Products of rounding factors
Suppose n rounding factors have errors |delta_i|≤u<1. For a product of factors (1+delta_i) or their inverses, every positive factor lies between 1-u and 1/(1-u): the inequalities 1+u≤1/(1-u) and 1/(1+u)≥1-u cover both types. Hence their product P lies between (1-u)^n and (1-u)^(-n). This argument is deterministic and does not assume independent, random or mean-zero errors.
Bernoulli’s inequality gives (1-u)^n≥1-nu. When nu<1 this lower bound is positive, so P≤1/(1-nu), while P≥1-nu. Therefore writing P=1+theta_n yields |theta_n|≤gamma_n=nu/(1-nu). The lower-side error is at most nu, and the stated gamma_n is a convenient common upper bound. For n=0 the empty product is one and gamma_0=0.
This proves the familiar first-order accumulation scale nu together with an explicit remainder denominator. Replacing gamma_n by nu without controlling the omitted higher terms is not the same rigorous bound. If nu≥1, the displayed gamma estimate no longer supplies a positive finite upper bound; that failure does not prove that every actual product is inaccurate or divergent. A different estimate or a smaller operation path may still be useful.
The factors must come from valid local rounding models. An overflowing intermediate, an unaccounted subnormal absolute error or an inaccurate function outside the promised contract cannot be inserted as though it had |delta|≤u. Exact zero intermediates can use a harmless delta=0 in an identity, but this factor bookkeeping does not legalize division by an actual zero operand. All later coefficient-product bounds inherit the same range and operation assumptions. For products of rounding factors and gamma bounds, see [Stochastic Rounding: Implementation, Error Analysis, and Applications](https://eprints.maths.manchester.ac.uk/2843/1/cfhm22.pdf); [Accurate Sum and Dot Product](https://www.tuhh.de/ti3/paper/rump/OgRuOi05.pdf).
Sequential sums and absolute certificates
For represented real inputs x1,…,xn, define sequential summation by s1=x1 and sk=fl(s_(k-1)+xk) for k=2,…,n. Assume the required nearest relative models hold for these additions. Unrolling them gives x1 times the product of factors from steps two through n, and for each later xi a product from its insertion step i through n. The longest coefficient path has n-1 factors. No rounding is charged to the initial assignment of an already represented x1.
If (n-1)u<1, each coefficient differs from one by at most gamma_(n-1). Taking the triangle inequality proves |shat-sum xi|≤gamma_(n-1) sum |xi|. This is an absolute error bound for the exact sum of the stored inputs. For one input the bound is zero; for an empty sum use the explicitly defined value zero. The proof does not infer the exact answer from a finite sample or assume favorable signs of the rounding errors.
When the exact sum s is nonzero, division gives the relative bound gamma_(n-1) kappa_sum, where kappa_sum=sum|xi|/|sum xi|. Nonnegative inputs have kappa_sum=1 unless all are zero. Opposite-sign cancellation can make it much larger. This factor measures potential sensitivity and the strength of this bound, not a claim that every evaluation order achieves the bound or necessarily loses digits. At s=0 an absolute certificate remains preferable to an undefined relative ratio.
If the intended inputs were exact reals converted before summation, their conversion errors need additional terms; the stored-input bound does not make them disappear. Likewise, a sum over uncertain physical data needs its stated input model. The operation-count coefficient bound also belongs to this particular sequential tree. Pairwise, compensated or wider-precision accumulation follows a different proof and may have a different error budget even when it sums the same mathematical terms. For recursive summation and conditioning bounds, see [The Accuracy of Floating Point Summation](https://nhigham.com/wp-content/uploads/2023/10/high93s.pdf); [Accurate Sum and Dot Product](https://www.tuhh.de/ti3/paper/rump/OgRuOi05.pdf).
Pairwise sums and fixed evaluation trees
A pairwise summation tree forms sums of smaller groups and then combines them. If its maximum root-to-leaf depth is d, unrolling the local rounding factors shows that each input coefficient contains at most d factors. Under the same valid nearest models and du<1, the absolute error is bounded by gamma_d sum|xi|. The total number of additions and the maximum number of additions on one input’s path are different quantities.
A balanced binary tree has depth at most ceil(log2 n) for n≥1; padding to a power of two with exact zero leaves gives a convenient construction. The one-input case has depth zero, while an empty sum must be defined separately. Thus the bound can replace a sequential n-1 path by a logarithmic-depth path. This is a mathematical comparison of error bounds, not a measurement of wall time, memory traffic or actual speed on a particular parallel system.
A smaller upper bound does not prove that a pairwise result is closer for every individual data set. One sequential order may happen to cancel exactly while another tree rounds. Relative accuracy still contains the sum condition factor, and exceptionally sensitive data can defeat a naive interpretation of either bound. The range assumptions also remain necessary at every internal node; reordering can change whether an intermediate overflows.
Reproducibility is another property. If the exact inputs, rounding contract and tree are fixed, deterministic operations can reproduce the same result. An unspecified parallel reduction can change its tree with thread scheduling or partitioning and need not be bitwise reproducible. Wider accumulation or a reproducible exact accumulator can define a different contract, but neither is implicit in the phrase pairwise sum. An accuracy proof and an execution-order specification serve different purposes. For pairwise summation and operation-depth analysis, see [The Accuracy of Floating Point Summation](https://nhigham.com/wp-content/uploads/2023/10/high93s.pdf).
Dot products
For a dot product of represented inputs, let ti=xi yi be the exact products. A conventional evaluation rounds each product and then sequentially adds them. The product rounding gives one factor, and its path through the remaining additions contributes at most n-1 more. Consequently every term has at most n factors, and the same coefficient-product argument yields |dhat-sum xi yi|≤gamma_n sum|xi yi| when nu<1 and the stated local models are valid.
This bound is absolute. If the dot product is nonzero, its relative form contains the cancellation factor sum|xi yi|/|sum xi yi|. A small computed dot product may therefore be sensitive even when every multiplication and addition meets its local promise. The formula concerns represented x and y; low-precision conversion of either vector contributes a separate data error. A very accurate accumulator cannot reconstruct a product term’s original operands after their information has been rounded away.
A fused recurrence si=fma(xi,yi,s_(i-1)) with s0=0 has one rounding at each step, without a separately rounded product. Unrolling it gives paths of at most n fused roundings and hence a safe gamma_n absolute bound of the same form. Fusion reduces the number of operation roundings and can improve particular results, but this comparison alone does not automatically change that worst path bound from gamma_n to gamma_(n/2) or guarantee a strictly smaller observed error for every input.
Range and semantic premises are essential. An unfused product may overflow before a finite later cancellation, while a fused operation can round only the final exact multiply-add result. Conversely a fused recurrence can still overflow its actual accumulator or underflow a relevant result. Mixed-precision instructions may round their inputs, products and accumulators in different formats. The proof must match those exact contracts rather than treating every instruction called a dot product as the same algorithm. For dot-product bounds and the locations of precision changes, see [Accurate Sum and Dot Product](https://www.tuhh.de/ti3/paper/rump/OgRuOi05.pdf); [Mixed Precision Algorithms in Numerical Linear Algebra](https://eprints.maths.manchester.ac.uk/2849/1/paper_eprint.pdf).
Horner evaluation
For a represented x and coefficients a0,…,an, ordinary Horner evaluation starts at an and repeatedly forms ri=fl(fl(r_(i+1)x)+ai). Each of the n stages has a multiplication rounding and an addition rounding. Unrolling the recurrence expresses the computed value as a polynomial with the same powers of the exact stored x and coefficient factors containing at most 2n local roundings. This is a statement about an explicitly chosen evaluation scheme, not a redefinition of the input polynomial.
When 2nu<1 and the normal local models apply, the resulting absolute bound is |phat-p(x)|≤gamma_(2n) sum_(i=0)^n |ai| |x|^i. It also supplies a componentwise backward coefficient interpretation with relative coefficient factors bounded by gamma_(2n). Zero coefficients can retain zero perturbation without dividing by them. A degree-zero polynomial needs no arithmetic evaluation stages, agreeing with gamma_0=0.
Fused Horner instead uses ri=fma(r_(i+1),x,ai) and has at most n factors on a coefficient path. Its analogous bound uses gamma_n. This is an improvement of the proved upper bound under a matched contract; it does not assert that a fused operation has no rounding or that it gives the correctly rounded value of the entire polynomial. Both methods can happen to be exact on particular data, and a factored expression may have a different useful error structure.
Ordinary Horner rounds the product before adding one. The fused evaluation postpones that rounding until after adding the constant. Factoring instead squares the small exactly represented difference. The specified range extension and gradual underflow determine which final small values are representable.
| Quantity | Exact result |
|---|---|
| First ordinary product then first result | 9/8, −7/8 |
| First fused result | −7/8 |
| Second exact ordinary product | −63/64 |
| Second rounded ordinary product | −1 |
| Second exact fused input | 1/64 |
| Rounded factored difference | 1/8 |
| Ordinary, fused, factored outputs | 0, 1/64, 1/64 |
| Exact polynomial target | 1/64 · Subnormal, two quanta |
| Signed errors in the three routes | −1/64, 0, 0 |
Exact inputs and supporting calculations
| Parameter | Value |
|---|---|
| p | 4 |
| emin | -4 |
| x | 9/8 |
For a nonzero polynomial value, the corresponding relative condition factor is sum |ai| |x|^i / |p(x)|. Near a root it can be large, so a small componentwise backward coefficient error does not by itself ensure a small forward relative answer. At a multiple root, exact structure and input sensitivity deserve particular care. The worked example compares expanded, fused and factored evaluation while keeping its explicitly extended subnormal range visible; no purely normal bound is silently applied to an unsupported tiny result. For ordinary and fused Horner bounds under their range assumptions, see [Improving the Compensated Horner Scheme with a Fused Multiply and Add](https://perso.ens-lyon.fr/nicolas.louvet/GrLL06.pdf).
Fused multiply-add
A fused multiply-add computes the exact real expression ab+c from its represented operands and rounds that combined result once to the specified format. Separate multiplication and addition first round ab, then add c and round again. The two algorithms can therefore give different answers even when both satisfy their own correctly rounded operation contracts. Fusion is not the same as carrying out two ordinary rounded operations more quickly.
In binary64 take a=1+2^(-27), b=1-2^(-27) and c=-1. The exact product is 1-2^(-54). Immediately below one the binary64 spacing is 2^(-53), so this product is the midpoint between one and its predecessor. The significand of one is even and that of the predecessor is odd; nearest ties to even rounds the product to one. The separately rounded addition then returns zero.
The exact combined expression ab+c is instead -2^(-54), a normal binary64 value. A correctly rounded fused operation returns it exactly. Both operands and the residual are representable, and no range failure is involved. This establishes a difference through exact bit-scale arithmetic, not a decimal display or a tolerance comparison. The fused answer is the exact combined target for this example, not a theorem that all fused results are exact.
Multiplying the two exact inputs gives 1−2^(−2k). The predecessor gap below one uses the lower binade, 2^−53. At the halfway value the retained significand at one is even. Fusion computes the exact residual before rounding to binary64; all three residual exponents lie within its normal range, so a serial zero here comes from rounding the product.
| Quantity | Exact result |
|---|---|
| Exact inputs | a=1+2^(−k), b=1−2^(−k), c=−1 |
| Binary64 normal exponent bounds | −1022 through 1023 |
| Exact product ab | 1−2^−54 |
| Deficit in gaps below 1 | 1/2 |
| Product rounding case | midpoint, choose even endpoint 1 |
| RN(ab) | 1 |
| Serial RN(RN(ab)−1) | 0 |
| Fused RN(ab−1) | −2^−54 |
| Signed serial error | 2^−54 |
| Fused result class | Exact nonzero normal; exponent −54 |
Exact inputs and supporting calculations
| Parameter | Value |
|---|---|
| p | 53 |
| k | 27 |
Fusion can also avoid a rounded intermediate product overflow when the combined exact result remains finite. It does not undo initial input rounding or guarantee accuracy for a larger algorithm whose other operations are sensitive. A source-language expression, compiler contraction setting and explicit fused operation may specify different semantics. Reproducibility and error analysis must say which operation is intended, and verify an actual implementation contract before relying on an assumed fusion. For fused multiply-add and exact product-residual context, see [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF); [Accurate Sum and Dot Product](https://www.tuhh.de/ti3/paper/rump/OgRuOi05.pdf).
Error-free sum transformations
An error-free transformation represents an exact arithmetic result as the real sum of two floating values. Under binary nearest rounding and sufficient finite range, FastTwoSum uses s=fl(a+b), z=fl(s-a), e=fl(b-z) when |a|≥|b|. Its theorem gives s+e=a+b exactly. The addition of s and e in that identity is a real equality, not a claim that one more floating addition will necessarily recover a new single floating value.
The magnitude condition is substantive. In the toy format, a=8,b=1/4 gives s=8,z=0,e=1/4, preserving the lost low part. Reversing the order gives s=8 and z=fl(8-1/4)=8 by the midpoint rule below eight; the final e becomes zero. Thus this wrong-order FastTwoSum loses the quarter. One cannot replace its precondition by the assertion that both operands are finite.
Full TwoSum removes the magnitude-order requirement: s=fl(a+b), bb=fl(s-a), aa=fl(s-bb), br=fl(b-bb), ar=fl(a-aa), e=fl(ar+br). The error-free transformation theorem proves s+e=a+b with the stated rounding and range hypotheses. For a=1/4,b=8, the intermediate values are s=8,bb=8,aa=0,br=0,ar=1/4,e=1/4, so the exact identity is explicitly recovered. The additional operations serve a precise cancellation/low-part reconstruction purpose.
The general transformation theorem uses the structure of floating rounding and exact cancellation, including Sterbenz-type arguments; it is not proved by those two examples. A clean sufficient scope here excludes overflow and places every nonzero intermediate and the exact residual in the normal finite range. More permissive gradual-underflow versions need their corresponding theorem rather than an automatic extension. Source qualification must check that scope. The low component may later support compensation, but rounding it into an accumulated correction introduces its own error analysis. For FastTwoSum and TwoSum, including their ordering conditions, see [The Accuracy of Floating Point Summation](https://nhigham.com/wp-content/uploads/2023/10/high93s.pdf); [Accurate Sum and Dot Product](https://www.tuhh.de/ti3/paper/rump/OgRuOi05.pdf).
Error-free products with a fused residual
A fused product residual can recover information discarded by a rounded product. Set p=fl(ab) and e=fma(a,b,-p). If ab and p meet the stated finite-range hypotheses and the exact residual ab-p is representable, the fused operation returns that residual exactly. Thus p+e=ab as a real identity. The representability premise is essential: a residual below the supported grid can itself round, and an infinite p does not supply an error-free decomposition.
The bit mechanism is visible in binary precision pbits. Write the represented significands as integers with at most pbits bits. Their exact product has at most 2pbits bits. In the normal product regime, rounding to pbits bits discards at most pbits low positions; subtracting the rounded aligned integer leaves an error with at most pbits significant bits. After restoring the common power-of-two scale, this low part is another floating value if its exponent and subnormal grid permit it. A fused residual performs this exact subtraction before its one final rounding.
For a=11/8 and b=13/8 in binary precision four, the exact product is 143/64. The nearest product is 9/4=144/64, so the exact residual is -1/64. In the stated extended toy range emin=-4, the subnormal quantum is 1/128 and this residual is representable. Consequently the pair (9/4,-1/64) certifies the exact product. A separate rounded multiplication would retain only the first component.
Such a two-component representation can support accurate dot products or compensated polynomial evaluation, but those algorithms still need a proof for how their low components are combined. Summing residuals in the original precision can round them again. Without a fused operation there are splitting-based product transformations with their own assumptions and costs; none is silently supplied by an ordinary multiplication symbol. The exact-product identity belongs to the verified transformation and range, not to every expression that happens to compute a small difference. For error-free product transformations and range restrictions, see [Accurate Sum and Dot Product](https://www.tuhh.de/ti3/paper/rump/OgRuOi05.pdf); [Improving the Compensated Horner Scheme with a Fused Multiply and Add](https://perso.ens-lyon.fr/nicolas.louvet/GrLL06.pdf).
Compensated sums
Compensated summation carries information about lost low parts into later updates. In the stated Kahan form, start with s=c=0 and use y=fl(x-c), t=fl(s+y), c=fl(fl(t-s)-y), then s=t. The sign convention matters: c estimates an overrun in the rounded addition, so the next input subtracts it. This is an explicit sequence of rounded assignments; reassociating the compensation expression by exact-real algebra can destroy its purpose.
Kahan summation is not an exact accumulator. In the first toy format, the sequence 8,1/4,-8 first reaches s=8,c=0, then s=8,c=-1/4. The last corrected input is fl(-8+1/4)=-8 by the midpoint rule below eight, and the final s and c are zero. The exact sum was 1/4. The compensation itself can lose information in an unfavorable next update, so a successful example cannot justify a universal exactness claim.
Neumaier compensation instead forms t=fl(s+x) and, according to the larger magnitude, computes the low correction as fl(fl(s-t)+x) or fl(fl(x-t)+s). Under the appropriate FastTwoSum hypotheses that local correction is the exact lost low part. It is then accumulated into c, and the reported answer is fl(s+c). For the same toy sequence, the middle addition contributes 1/4 to c and the final cancellation contributes zero, so the final answer is 1/4. The accumulated correction and final addition can still round on other inputs.
The standard compensated-summation theorem, under its nearest-rounding and finite-range assumptions, gives a first-order bound of the form (2u+O(nu²)) sum|xi| for the specified Kahan analysis, rather than the ordinary first-order n u scale. The algorithm and higher-order term must be qualified from an actual theorem. An unspecified O-term is not a numerical certificate with a known constant, especially for a long sum. The toy failure is compatible with a valid absolute bound; relative sensitivity, conversion error and range failures remain separate issues. For compensated summation and its scoped error bounds, see [The Accuracy of Floating Point Summation](https://nhigham.com/wp-content/uploads/2023/10/high93s.pdf); [Accurate Sum and Dot Product](https://www.tuhh.de/ti3/paper/rump/OgRuOi05.pdf).
Scaling to protect dynamic range
Dynamic range can fail before a well-scaled answer is obtained. For finite real a and b let m=max(|a|,|b|). If m>0, the Euclidean norm satisfies sqrt(a²+b²)=m sqrt((a/m)²+(b/m)²). The ratios have magnitude at most one, so their squares cannot overflow. If m=0 both inputs are zero and the norm is assigned zero separately. Infinity, NaN and zero-sign handling require their corresponding operational branches rather than an unchecked division by m.
In binary64 take a=3·2^600 and b=4·2^600. Both inputs and the exact norm 5·2^600 are finite, but their naive squares have exponents far beyond the largest binary64 normal exponent. The scaled ratios are 3/4 and 1. Their squares are 9/16 and 1, their sum is 25/16, and its square root is 5/4. Every one of these values is exactly representable. Multiplication by m=4·2^600 then gives the exact finite norm.
The derivation is dimensionally consistent: m has the same units as the inputs, the ratios and square-root factor are dimensionless, and the final result has the original units. This matters when the norm is interpreted as a physical magnitude. Replacing a dimensional expression by an arbitrary small tolerance would not prove a range or accuracy bound, and changing units changes the representability scales even though the exact physical quantity is the same.
Scaling fixes this particular avoidable overflow without making every norm evaluation correctly rounded. A ratio of vastly different inputs can underflow; the square root and final product may round; and a genuinely too-large norm can still overflow. Accurate standard hypot implementations need their own contract and proof. The displayed example establishes exactness through its specific representable intermediates, not a blanket guarantee for all a and b or a promise about a named platform’s implementation. For scaling and arithmetic-range context, see [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html); [Mixed Precision Algorithms in Numerical Linear Algebra](https://eprints.maths.manchester.ac.uk/2849/1/paper_eprint.pdf).
Small elementary-function differences
Small elementary-function differences have the same structural issue as a rationalized square root. For x near zero, log(1+x) is approximately x, but a preliminary floating addition can turn 1+x into exactly one and the later logarithm into zero. A log1p operation, by its mathematical target, approximates log(1+x) from the original represented x without requiring that destructive preliminary addition as its public contract. Its actual error guarantee must still be stated.
Similarly, expm1 targets exp(x)-1 directly instead of first rounding exp(x) near one and then subtracting one. A series or another range-reduced algorithm can preserve small terms, but the function name alone is not a proof of correct rounding or a rigorous ulp bound. The real domains differ: log1p needs x>-1 for a finite real value, while expm1 is defined for every finite real x but can encounter overflow or very small-result issues in a bounded format.
The identity 1-cos(x)=2 sin²(x/2) can avoid subtracting a cosine close to one. It is exact in real arithmetic. Its numerical advantage requires an accurate small sine, a valid division by two, appropriate product range and an error model for argument reduction. For large arguments, for subnormal x/2 or for an underflowing square, those questions cannot be ignored. No rewrite cures an inaccurate elementary function or every original-data sensitivity problem.
These examples motivate choosing an expression whose useful information survives the intermediate representation. They do not say that every algebraic rewrite is better, that every library supplies the named specialized operation, or that its behavior is identical across languages and modes. An analysis should name the exact target, domain and function-accuracy assumptions, then carry their errors through the remaining arithmetic. Finite spot checks and familiar decimal output are evidence only for the checked cases. For cancellation-avoiding function evaluation and enclosure requirements, see [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html); [Verification methods: Rigorous results using floating-point arithmetic](https://www.tuhh.de/ti3/rump/intlab/ActaNumerica2010.pdf).
Double rounding
Nearest rounding is idempotent when the same map is applied twice, but different precisions need not compose to the lower-precision rounding. A first rounding can land on an exact midpoint of the final format, even when the original real value was strictly on one side. The second ties-to-even decision then loses that side information. An intermediate format having more bits does not automatically rule out this mechanism.
Take final binary precision three and intermediate precision four, with adequate range, and exact x=37/32. Around one the precision-three values are 1 and 5/4, with midpoint 9/8. The original x is greater than 9/8, so direct rounding gives 5/4. In precision four the adjacent values 9/8 and 5/4 bracket x, and x is closer to 9/8, so the first rounding gives 9/8 exactly.
The second rounding now sees the precision-three midpoint. The lower endpoint 1 has even significand integer 4, while 5/4 has odd integer 5, so it returns 1. Thus direct rounding is 5/4 but the two-stage result is 1. Every comparison follows from exact fractions and midpoint parity; neither a decimal display nor an implementation-specific extended register is needed for the counterexample.
Use the exact rational to select nearest on each grid. The finer grid can round the input to the coarser midpoint, where parity rather than the original exact distance decides the second step. An input already representable in the intermediate grid does not move before the last step.
| Quantity | Exact result |
|---|---|
| p=3 neighbors and significands | 1, 5/4; 4, 5 |
| p=3 midpoint | 9/8 |
| p=4 bracket and significands | 9/8, 5/4; 9, 10 |
| p=4 distances | 1/32, 3/32 |
| First result | 9/8 |
| Second step is a tie | Yes |
| Direct p=3 result | 5/4 |
| Chained p=3 result | 1 |
| Direct and chained signed errors | 3/32, −5/32 |
Exact inputs and supporting calculations
| Parameter | Value |
|---|---|
| final | 3 |
| intermediate | 4 |
| x | 37/32 |
Extra precision can still improve many calculations, and some combinations of modes or carefully designed intermediate rounding rules avoid double-rounding problems. Those are separate theorems with their own conditions. Converting through another radix, printing and reparsing, or assigning to a different storage type can create additional rounding stages. The relevant question is which maps actually act on the value, not whether an intermediate type sounds more accurate. For midpoint double rounding and the limits of round-to-odd remedies, see [When double rounding is odd](https://guillaume.melquiond.fr/doc/05-imacs17_1-article.pdf); [Stochastic Rounding: Implementation, Error Analysis, and Applications](https://eprints.maths.manchester.ac.uk/2843/1/cfhm22.pdf).
Decimal conversion and round trips
Decimal conversion distinguishes an exact decimal target from the binary value that represents it. Correctly rounded parsing maps the exact decimal rational to a chosen binary neighbor. Formatting maps the stored binary rational to a decimal string, often choosing a shortest string that parses back to the same value. A short round-trip string is not necessarily the exact decimal expansion of the stored rational. Thus a displayed 0.1 can faithfully identify a stored binary value without asserting equality with 1/10.
A sufficient digit count for round-tripping binary64 can be justified by spacing. For a finite nonzero binary precision-53 value x, the smaller adjacent finite gap is at least 2^(-53)|x|, with the subnormal cases no worse for this relative comparison. A decimal rounding to 17 significant digits has relative error at most 5·10^(-17), which is strictly smaller than 2^(-54). Hence that decimal value lies strictly inside the nearest-rounding interval of x and correctly rounded binary parsing returns x.
The largest and smallest finite magnitudes also satisfy this round-trip argument. At the positive binary64 maximum F=(2-2^(-52))2^1023, the gap to the preceding finite value is h=2^971, and the ideal next value at unbounded exponent is 2^1024 with the same gap h. The nearest overflow threshold from the earlier range analysis is F+h/2, so a decimal approximation with |d-F|<2^(-54)F<h/2 stays below that threshold and above the lower midpoint. At the least positive subnormal eta, the neighbors are zero and 2eta, so |d-eta|<2^(-54)eta<eta/2 keeps d strictly inside its rounding interval. Interior subnormals have the same eta grid. Negative values follow by reflection; this argument still says nothing about preserving a signed-zero encoding or a NaN payload.
The strict inequality can be checked as 5·2^54<10^17, so the argument does not rely on a rounded logarithm approximation. It concerns significant digits, not a fixed count of digits after the decimal point. It is sufficient, not a statement that every value needs 17 digits: many values have shorter round-trip strings or exact short decimal expansions. The digit theorem assumes the specified formatting/parsing and adequate textual exponent handling.
Signed zero, infinity and NaN payloads are not covered by a finite nonzero real-value spacing argument. Preserving their encodings or operational distinctions needs a serialization contract. Locale, parsing modes and deliberate precision changes can also alter what a string means. A reliable numerical record should therefore preserve the intended format and conversion semantics rather than equate the number of printed digits with a proof of accuracy in an original real-data problem. For binary64 parameters and decimal-conversion context, see [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF); [Mixed Precision Algorithms in Numerical Linear Algebra](https://eprints.maths.manchester.ac.uk/2849/1/paper_eprint.pdf).
The exact-integer range
In binary precision p, assuming the exponent range contains the region and the format includes unit spacing, every integer from zero through 2^p is exactly representable. Integers below 2^p use at most p binary digits; the endpoint 2^p has one nonzero digit and a larger exponent. Negative counterparts follow by sign. This is a consecutive-integer guarantee, not a claim that every finite real in that interval is represented.
The next integer 2^p+1 needs p+1 nonredundant bits and is not representable at that precision. In its binade the spacing is two. It is the midpoint between 2^p and 2^p+2, and nearest ties to even chooses 2^p. The adjacent lower significand is even and the upper one odd. Further out, larger spacings exclude still more integers, while suitable multiples of those spacings remain exactly representable.
A floating counter can therefore stagnate when its increment is too small relative to the local gap. In the toy format at eight, adding 1/2 produces the midpoint 8.5 and rounds back to eight. A loop that expects every such update to advance cannot be justified by the exact-real statement that its increment is positive. The analogous unit-increment problem occurs at 2^p when that region is in range.
This phenomenon is different from fixed-width integer overflow and from an incorrect loop-bound comparison. An integer counter with a separately checked integer range may be more appropriate, but converting its results to floating point still has the representation limits just proved. Nor should one state that all larger integers are inexact: even or more widely spaced values can remain exact. The guarantee and the failure must name the precision, exponent range and actual increment. For integer representation and format precision, see [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF); [Mixed Precision Algorithms in Numerical Linear Algebra](https://eprints.maths.manchester.ac.uk/2849/1/paper_eprint.pdf).
Outward-rounded intervals
A deterministic interval [L,U] represents all real values between its endpoints, not a probability distribution. If an exact operation is monotone on a valid domain, downward rounding of its exact lower result and upward rounding of its exact upper result produce an enclosure. For addition, use downward(L1+L2) and upward(U1+U2). For subtraction, use downward(L1-U2) and upward(U1-L2). These directions follow the exact interval extremizers, not a symmetric tolerance around one computed point.
Multiplication uses the minimum and maximum of the four endpoint products before directed rounding, with appropriate finite or extended-range conventions. Division requires the denominator interval to exclude zero; an interval containing zero cannot be assigned one ordinary finite quotient enclosure by ignoring that point. Elementary functions require monotonicity/range subdivision and their own verified endpoint accuracy. A correctly rounded basic-operation contract does not automatically certify an arbitrary function endpoint.
Nearest rounding alone does not make a displayed endpoint outward. One can use a proven error bound or an appropriate adjacent-representable adjustment only when the underlying operation accuracy and exceptional cases justify it. Gradual underflow, overflow to infinite endpoints and signed zero can affect these choices. The enclosure proof belongs to the whole endpoint procedure and input intervals, rather than to a few observed decimal digits.
Interval dependency can make an enclosure wide while it remains correct. If one variable x lies in [1,2], interval subtraction of [1,2] from itself gives [-1,1], even though the correlated expression x-x is exactly zero. The arithmetic rule forgot that both occurrences denote the same value. Algebraic reformulation or a richer dependency model may tighten the bound; its width is not evidence that every actual subtraction is inaccurate or that the measured variable has a stochastic spread. For outward rounding, interval rules and dependency, see [Verification methods: Rigorous results using floating-point arithmetic](https://www.tuhh.de/ti3/rump/intlab/ActaNumerica2010.pdf).
Residuals and error bounds
A residual relates a proposed answer to an equation, but its own evaluation can round. For a square-root problem with a≥0 and a proposed xhat≥0, define the exact residual r=xhat²-a. Factorization gives r=(xhat-sqrt(a))(xhat+sqrt(a)). Unless both a and xhat are zero, the second factor is positive. Thus |xhat-sqrt(a)|=|r|/(xhat+sqrt(a)). This is an exact mathematical identity before any computed residual or quotient is substituted.
If an independently justified L≥0 satisfies L≤sqrt(a) and xhat+L>0, an upper residual bound |r|≤R yields the deterministic error bound R/(xhat+L). The lower-bound premise cannot be omitted near zero. Another general absolute bound for nonnegative xhat and sqrt(a) is |xhat-sqrt(a)|≤sqrt(|r|), because their sum is at least the absolute value of their difference. These alternatives explain what extra information converts a residual into an answer certificate.
A rounded residual rhat is not automatically an upper bound for |r|. A fused residual rounds xhat²-a only once, but can still be inexact or tiny. Under a valid mixed error model |rhat-r|≤u|r|+eta/2, rearrangement gives |r|≤(|rhat|+eta/2)/(1-u). Exact or outward-rounded arithmetic can turn that expression into a rigorous R. In particular a displayed rhat=0 does not justify an exact-zero conclusion if underflow or an unbounded evaluation error was possible.
The coefficient a in this certificate is the stated mathematical input. If it was already rounded from different real data, that input difference contributes another sensitivity term. Computing a small residual in a wider format can help bound the residual more accurately, but does not remove input uncertainty or an ill-conditioned denominator. The equation, sign/range assumptions, residual enclosure and error conversion all belong to the certificate; a decimal threshold alone supplies none of them. For verification and the arithmetic model underlying this independently derived scalar residual certificate, see [Verification methods: Rigorous results using floating-point arithmetic](https://www.tuhh.de/ti3/rump/intlab/ActaNumerica2010.pdf); [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF).
Evaluation contracts and reproducibility
An evaluation contract specifies more than a nominal storage type. It includes the operand and intermediate precision, rounding mode, exponent behavior, fused versus separate operations and the permitted evaluation tree. The same final format can receive different results after reassociation, fusion or an intermediate precision change. The exact examples in this lesson demonstrate these mathematical possibilities without relying on a claim about any particular current compiler.
If a compiler or execution mode is permitted to reassociate expressions, an error proof for the original sequential tree may no longer describe the generated calculation. If it contracts a multiply-add, a two-rounding proof may likewise need revision. Additional precision can reduce errors but can also introduce the demonstrated double-rounding decision at a later storage boundary. These are specific contract changes, not reasons to regard every optimization as either harmless or inherently inaccurate.
Subnormal flushing or input denormal handling changes the small-value model, while exceptional-result and comparison rules affect stopping tests. A parallel reduction can choose a different tree or order. Repeating a computation on one machine therefore establishes the observed behavior only under that actual context; it does not prove the behavior of a different architecture, compilation option, library revision or scheduling policy. Verification of such claims needs current primary documentation and a matching observed contract.
Reproducibility, accuracy and speed are separate properties. A fixed but poor tree can reproduce an inaccurate result, and two valid accurate results can differ in their last bits. A performance claim also needs measurements rather than an operation-count argument alone. A trustworthy report names the contract under which its mathematical error bound was proved and distinguishes it from any implementation observation. This keeps a correct abstract theorem from being mistaken for a universal platform promise. For execution order, fusion, intermediate precision and double rounding, see [Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF); [Mixed Precision Algorithms in Numerical Linear Algebra](https://eprints.maths.manchester.ac.uk/2849/1/paper_eprint.pdf); [When double rounding is odd](https://guillaume.melquiond.fr/doc/05-imacs17_1-article.pdf).
Stochastic rounding
For a finite exact x between adjacent floating values a<b, ideal stochastic rounding selects a with probability (b-x)/(b-a) and b with probability (x-a)/(b-a). The probabilities are nonnegative and sum to one. Their weighted mean is exactly x, so the one-step error has mean zero. At an endpoint the corresponding probability is one, and an out-of-range x requires another contract rather than a negative probability.
The variance is ((b-x)(x-a)²+(x-a)(b-x)²)/(b-a)=(x-a)(b-x), at most (b-a)²/4. Each individual error is either a-x or b-x and can exceed the nearest half-gap bound. For x=13/10 between 1 and 3/2, the upper probability is 3/5 and the lower probability is 2/5; the variance is 3/50, with errors 1/5 and -3/10. Unbiasedness is an expectation statement, not a guarantee that one result is closer than nearest rounding.
For a sequential sum written as an exact recurrence plus stochastic errors, a conditional mean-zero rule given the past makes those errors martingale differences. Their cross terms have zero expectation under the corresponding integrability conditions, so a variance analysis can sum conditional variance contributions. The step sizes still depend on the intermediate states, and a deterministic per-run or high-probability statement needs its own boundedness and dependence proof. One cannot simply replace every worst-case n factor by sqrt(n) in an unrelated algorithm.
Nonlinear processing of unbiased data is not generally unbiased: squaring x+epsilon has expectation x²+Var(epsilon) when epsilon has mean zero. Finite random-bit implementations must also realize or approximate the declared probabilities under a specified policy. Stochastic rounding may be useful in low-precision computation, but this elementary calculation neither proves improved learning or physical simulation outcomes nor removes overflow, measurement uncertainty or algorithm conditioning. Those are additional hypotheses and evidence. For ideal stochastic rounding and the assumptions of probabilistic error analysis, see [Stochastic Rounding: Implementation, Error Analysis, and Applications](https://eprints.maths.manchester.ac.uk/2843/1/cfhm22.pdf).
Mixed precision and quantized inputs
Mixed precision assigns different formats to input storage, products, accumulation and output. A wider accumulator can reduce accumulation rounding while leaving low-precision conversion error untouched. An error proof should first define the exact target from the original data, then the converted data and product target, and only then the arithmetic used to sum them. The word precision without those locations does not specify one algorithm.
A binary product of two p_low-bit significands has at most 2p_low bits. It can therefore be represented exactly in an accumulator format with at least that precision if its exponent and subnormal range also permit the exact value. Precision alone is insufficient: the exact product can overflow or underflow the wider format’s particular exponent range. A multiply-accumulate instruction may also impose its own product rounding before the accumulation, which must be verified rather than assumed.
Take exact real a=(1+2^(-10),1-2^(-10)) and b=(1,-1). Under nearest conversion to binary precision eight, both entries of a become one: above one the half-gap is 2^(-8), and below one it is 2^(-9), each larger than 2^(-10). Their represented products with b are then 1 and -1. Even an exact accumulator returns zero, whereas the original real dot product was 2^(-9). Precision 24 in the accumulator cannot reconstruct information discarded before multiplication.
Conversely, when input quantization is acceptable under a stated data model, accurate wider accumulation can be valuable and can be analyzed by a matched dot-product bound. Scaling, loss coefficients and algorithm conditioning still matter. A generic format example does not establish the precision or behavior of a named AI device or kernel, nor does it promise an accuracy/performance tradeoff for every model. Such implementation and application claims require their own current evidence. For separate input, product, accumulator and output precisions, see [Mixed Precision Algorithms in Numerical Linear Algebra](https://eprints.maths.manchester.ac.uk/2849/1/paper_eprint.pdf).
Units and measurement uncertainty
Physical measurements and floating-point arithmetic use different error models. Suppose a measured radius lies in [r0-Delta,r0+Delta] with r0≥Delta≥0. For A(r)=pi r², the exact data effect satisfies |A(r)-A(r0)|≤pi(2r0 Delta+Delta²). This follows directly by expanding (r0+e)²-r0² with |e|≤Delta and taking absolute values. The statement is a deterministic enclosure based on the stipulated measurement interval.
If a numerical calculation separately certifies |Ahat-A(r0)|≤B, the triangle inequality gives |Ahat-A(r)|≤B+pi(2r0 Delta+Delta²). The arithmetic budget B must account for the represented radius, approximation to pi, operations and range as appropriate. A more accurate accumulator can reduce part of B but does not shrink the measurement interval. For r0>0, dividing the data term by pi r0² gives 2Delta/r0+(Delta/r0)²; at zero an absolute form remains the relevant one.
Units are retained throughout: radius and Delta have length units, area and B have squared-length units, and the relative expression is dimensionless. Converting meters to centimeters changes numerical magnitudes and their absolute floating spacings, but not the exact physical interval when the conversion is correctly modeled. A threshold called small without a unit or an explicit relative scale cannot serve as a dimensionally meaningful error certificate.
An interval half-width is not automatically a standard deviation or a stated confidence level. Statistical combination needs an actual probabilistic model and its correlations; deterministic worst-case combination uses the given inequalities. Quantization, measurement noise and rounding can interact in an application, but their separation in the mathematical model makes the resulting claim reviewable. The elementary area example illustrates that principle without inventing an instrument specification or an observed experimental accuracy. For represented data and rigorous error enclosures, see [Verification methods: Rigorous results using floating-point arithmetic](https://www.tuhh.de/ti3/rump/intlab/ActaNumerica2010.pdf); [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html).
A trustworthy floating-point certificate
A floating-point claim begins with the exact target and represented inputs, the radix and precision, exponent limits, rounding modes and special-value behavior. It then specifies the evaluation tree, fused operations, function contracts and any range assumptions. Those facts determine which local error models are available. Without them, a quoted unit round-off or a long printed decimal cannot establish what computation was performed or what quantity its error is measured against.
Exact identities, error-free transformations and finite-format enumerations support different conclusions. A rational midpoint calculation can certify one rounding decision; an error-free sum theorem needs its ordering and range premises; a gamma bound covers a stated family of evaluation paths. No finite collection of examples proves every structural rounding theorem or the behavior of every implementation. Computational checks should retain all declared input, actual and expected data rather than replace a missing result by an aggregate success count.
A forward error bound compares the computed answer with the original target; a backward interpretation perturbs specified data; a residual needs its own enclosure and error-conversion argument. Relative bounds need a nonzero scale, while interval bounds and probabilistic expectations require different premises. A point estimate, a deterministic enclosure, a high-probability bound and an unbiased estimator are not interchangeable labels. Each can be useful when its exact claim is stated.
The connections to scientific computing, engineering and low-precision AI depend on preserving these distinctions. A stable reformulation can avoid unnecessary cancellation, wider accumulation can reduce some arithmetic error, and scaling can protect dynamic range. None removes every input uncertainty or proves a platform’s execution contract. The next numerical lessons can build on this representation and round-off foundation while keeping exact mathematics, implementation observations and error certificates separate. For the arithmetic, algorithmic and verification framework used by this certificate, see [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html); [The Accuracy of Floating Point Summation](https://nhigham.com/wp-content/uploads/2023/10/high93s.pdf); [Accurate Sum and Dot Product](https://www.tuhh.de/ti3/paper/rump/OgRuOi05.pdf); [Stochastic Rounding: Implementation, Error Analysis, and Applications](https://eprints.maths.manchester.ac.uk/2843/1/cfhm22.pdf); [Mixed Precision Algorithms in Numerical Linear Algebra](https://eprints.maths.manchester.ac.uk/2849/1/paper_eprint.pdf); [Verification methods: Rigorous results using floating-point arithmetic](https://www.tuhh.de/ti3/rump/intlab/ActaNumerica2010.pdf).
Check toy encoding ranges, exact rounding decisions, fused residuals and near-zero evaluation before using decimal approximations.
Toy-format limits and ties to even
Lower even significand
Store one sign bit, three exponent bits of bias three, and three fraction bits. Nonzero middle exponents have an implicit leading one. At zero exponent the leading bit vanishes, giving gradual subnormals. At the all-one exponent the fraction distinguishes infinities and NaNs. At equal distances inspect the actual retained integer significands rather than the values’ signs.
| Quantity | Exact result |
|---|---|
| Least positive subnormal | 1/32 |
| Largest positive subnormal | 7/32 |
| Least positive normal | 1/4 |
| Largest finite | 15 |
| Unit round-off | 1/16 |
| Upward spacing at 1, downward gap | 1/8, 1/16 |
| Predecessor of 1 | 15/16 |
| Bracketing stored values | 1, 9/8 |
| Endpoint bit patterns | 0 011 000 and 0 011 001 |
| Significand integer parities | 8 and 9 |
| Nearest-even stored value | 1 |
| Signed rounding error | −1/16 |
Exact inputs and supporting calculations
| Parameter | Value |
|---|---|
| p | 4 |
| emin | -2 |
| emax | 3 |
| x | 17/16 |
| Category | Number of encodings |
|---|---|
| Normal | 96 |
| Nonzero subnormal | 14 |
| Signed zeros | 2 |
| Infinity | 2 |
| NaN | 14 |
| Total | 128 |
| Total finite encodings | 112 |
| Distinct finite numeric values | 111 |
Signed rounding modes on one number line
Positive nonmidpoint
Directed rounding uses the exact ordering of the two endpoints. Nearest uses the two exact distances, with parity breaking a tie. Signed error is rounded value minus the original rational.
| Quantity | Exact result |
|---|---|
| Distances from lower and upper neighbors | 1/10, 1/40 |
| Endpoint significands | 8, 9 |
| Midpoint | No |
Exact inputs and supporting calculations
| Parameter | Value |
|---|---|
| p | 4 |
| x | 11/10 |
| Mode | Stored value | Signed error |
|---|---|---|
| Nearest ties-even | 9/8 | 1/40 |
| Downward | 1 | −1/10 |
| Upward | 9/8 | 1/40 |
| Toward zero | 1 | −1/10 |
Every operation rounds independently
A lost midpoint addend
The exact target is the small addend. The spacing at the large input depends on its exponent. After the first operation has rounded to the large number, an exact subtraction of that stored value cannot reconstruct discarded information. With the subtraction first, equal large inputs cancel exactly and the small exact operand remains.
| Quantity | Exact result |
|---|---|
| Format | p=4, e_min=−2, e_max=3, gradual underflow |
| Exact first sum | 17/2 |
| First bracket | 8, 9 |
| Neighbor distances | 1/2, 1/2 |
| First rounded sum | 8 |
| Signed first error | −1/2 |
| Left steps | RN(17/2)=8; RN(8−8)=0 |
| Right steps | RN(8−8)=+0; RN(0+1/2)=1/2 |
| Final signed errors | −1/2, 0 |
Exact inputs and supporting calculations
| Parameter | Value |
|---|---|
| p | 4 |
| big | 8 |
| small | 1/2 |
Compare fusion with serial rounding
Below-one midpoint
Multiplying the two exact inputs gives 1−2^(−2k). The predecessor gap below one uses the lower binade, 2^−53. At the halfway value the retained significand at one is even. Fusion computes the exact residual before rounding to binary64; all three residual exponents lie within its normal range, so a serial zero here comes from rounding the product.
| Quantity | Exact result |
|---|---|
| Exact inputs | a=1+2^(−k), b=1−2^(−k), c=−1 |
| Binary64 normal exponent bounds | −1022 through 1023 |
| Exact product ab | 1−2^−54 |
| Deficit in gaps below 1 | 1/2 |
| Product rounding case | midpoint, choose even endpoint 1 |
| RN(ab) | 1 |
| Serial RN(RN(ab)−1) | 0 |
| Fused RN(ab−1) | −2^−54 |
| Signed serial error | 2^−54 |
| Fused result class | Exact nonzero normal; exponent −54 |
Exact inputs and supporting calculations
| Parameter | Value |
|---|---|
| p | 53 |
| k | 27 |
Stepwise evaluation near a double root
The second product rounds before cancellation
Ordinary Horner rounds the product before adding one. The fused evaluation postpones that rounding until after adding the constant. Factoring instead squares the small exactly represented difference. The specified range extension and gradual underflow determine which final small values are representable.
| Quantity | Exact result |
|---|---|
| First ordinary product then first result | 9/8, −7/8 |
| First fused result | −7/8 |
| Second exact ordinary product | −63/64 |
| Second rounded ordinary product | −1 |
| Second exact fused input | 1/64 |
| Rounded factored difference | 1/8 |
| Ordinary, fused, factored outputs | 0, 1/64, 1/64 |
| Exact polynomial target | 1/64 · Subnormal, two quanta |
| Signed errors in the three routes | −1/64, 0, 0 |
Exact inputs and supporting calculations
| Parameter | Value |
|---|---|
| p | 4 |
| emin | -4 |
| x | 9/8 |
Direct versus two-stage nearest rounding
Two-stage rounding changes the result
Use the exact rational to select nearest on each grid. The finer grid can round the input to the coarser midpoint, where parity rather than the original exact distance decides the second step. An input already representable in the intermediate grid does not move before the last step.
| Quantity | Exact result |
|---|---|
| p=3 neighbors and significands | 1, 5/4; 4, 5 |
| p=3 midpoint | 9/8 |
| p=4 bracket and significands | 9/8, 5/4; 9, 10 |
| p=4 distances | 1/32, 3/32 |
| First result | 9/8 |
| Second step is a tie | Yes |
| Direct p=3 result | 5/4 |
| Chained p=3 result | 1 |
| Direct and chained signed errors | 3/32, −5/32 |
Exact inputs and supporting calculations
| Parameter | Value |
|---|---|
| final | 3 |
| intermediate | 4 |
| x | 37/32 |
Worked examples
A complete small binary format
Use an IEEE-shaped toy encoding with one sign bit, three exponent bits of bias three and three fraction bits. Normal precision is four, with emin=-2 and emax=3. Derive the least positive subnormal, least normal, largest finite value, unit round-off and spacing at one. Count finite encodings, infinities and NaN encodings, keeping signed zeros distinct as encodings. Round 17/16 and 19/16 by nearest ties to even.
- Interior exponent fields are E=1,…,6, so the actual exponents e=E-3 run from -2 through 3. The significand integer is m=8+f with f=0,…,7. Thus a normal magnitude is m·2^(e-3), its minimum is 8·2^(-5)=1/4 and its maximum is 15·2^0=15. With E=0 the nonzero fraction integers give subnormals f/32, so eta=1/32 and there are seven positive subnormal magnitudes.
- At one, exponent zero gives spacing 2^(-3)=1/8, hence epsilon=1/8 and the nearest unit round-off u=1/16. Immediately below one, the smaller binade has spacing 1/16; its final value is 15/16. These are format properties derived from the explicit significands and exponents, not a claim about a default machine type.
- For each sign there are six normal exponent fields times eight fraction fields, plus eight zero-exponent encodings including zero. This gives 2(48+8)=112 finite encodings. There are 55 positive nonzero finite values and 55 negative ones, hence 111 ordinary real finite values after identifying the two zeros. The all-one exponent field with f=0 supplies two signed infinities; its seven nonzero fraction fields per sign supply 14 NaN encodings. The totals add to 128, the full seven-bit encoding count.
- Near one the significand integers 8,9,10 represent 1,9/8,5/4. The exact midpoint 17/16 lies between the first two, so even parity selects 1. The exact midpoint 19/16 lies between the last two, so parity selects 5/4. Both results are finite and normal. The distinction between 111 finite real values and 112 finite encodings is the signed-zero distinction, not an extra tiny nonzero number.
The toy format has p=4, eta=1/32, mu=1/4, Fmax=15, u=1/16 and successor spacing 1/8 at one. It has 112 finite encodings, two infinities and 14 NaN encodings. The two nearest-even results are 1 and 5/4.
The exact binary value of one tenth
Assume the binary64 format with precision 53 and nearest ties to even, with all displayed values in normal range. Derive the exact stored fraction for decimal 0.1, its signed absolute and relative error, and the corresponding 0.2 value. Then calculate the rounded sum of the two stored values and compare it with the stored value of decimal 0.3; use exact rational arithmetic rather than a printed decimal as the certificate.
- The exact tenth lies in the binary binade [2^(-4),2^(-3)), whose binary64 spacing is 2^(-56). Scaling it by 2^56 gives 7205759403792793.6 exactly as a decimal rational. The nearest integer significand is M=7205759403792794, so the stored value is M/2^56=3602879701896397/2^55. The two possible neighbors on the actual precision-53 grid have been identified; using the reduced fraction alone must not hide that grid spacing.
- Write m=3602879701896397. Since 10m-2^55=2, the signed error m/2^55-1/10 is 1/(5·2^55). Dividing by 1/10 gives 2/2^55=2^(-54), smaller than u=2^(-53). The exact fifth lies in the next binade with spacing 2^(-55), has the same integer significand M and is stored as m/2^54, exactly twice the stored tenth. This follows from a matched power-of-two scale, not from a decimal-printing assumption.
- The exact sum of those stored operands is 3m/2^55=10808639105689191/2^55. In the [1/4,1/2) binade, spacing is 2^(-54). With N=5404319552844595, this sum is (N+1/2)/2^54, exactly midway between N/2^54 and (N+1)/2^54. N is odd and N+1 is even, so the correctly rounded sum is (N+1)/2^54=5404319552844596/2^54.
- For the original real target 3/10, scaling by 2^54 gives N+1/5, so its nearest stored value is N/2^54. The rounded operand sum is therefore larger by exactly 2^(-54), one ulp in that binade. Correct addition of the stored tenth and fifth has not failed: the original target data were already rounded and the sum encountered an exact tie. These fractions certify the difference independently of any short or long decimal display.
The stored tenth is 3602879701896397/2^55, with signed error 1/(5·2^55) and relative error 2^(-54). The stored fifth is twice that value. Their rounded sum is 5404319552844596/2^54, one ulp above the stored three-tenths 5404319552844595/2^54.
Directed rounding on both sides of zero
In binary precision four and a range containing the values, round 11/10 and -11/10 under nearest ties to even, upward, downward and toward zero. Give exact signed errors and explain why changing the sign swaps the directed endpoint choices.
- Around the positive target 11/10, the precision-four neighbors are 1 and 9/8. Their distances are 1/10 and 1/40, respectively, so nearest selects 9/8 without a tie. Its signed error is 9/8-11/10=1/40. The relative magnitude is (1/40)/(11/10)=1/44.
- Downward rounding cannot exceed 11/10 and therefore selects 1, with signed error -1/10. Upward selects 9/8 with error 1/40. Toward zero agrees with downward for this positive target. The finite format range in this example contains both neighbors, so no overflow or underflow convention participates.
- Reflect the target and neighbor pair. For -11/10, the ordered endpoints are -9/8 and -1. Nearest returns -9/8 with signed error -1/40; downward also selects -9/8. Upward selects -1 with signed error 1/10, and toward zero now agrees with upward. The nearest relative magnitude remains 1/44 because the comparison uses the absolute target size.
- The nearest error is consistent with u=1/16, and the directed relative magnitude 1/11 is consistent with the weaker 2u=1/8 bound. The directed error need not be at most a half-gap. These exact signs also explain why toward-zero and downward cannot be treated as synonyms on negative data.
For 11/10, nearest and upward give 9/8, while downward and toward zero give 1. For -11/10, nearest and downward give -9/8, while upward and toward zero give -1. Nearest signed errors are ±1/40 with relative magnitude 1/44.
The normal model at the underflow boundary
In the toy format of the first example let eta be the least positive subnormal and mu the least normal. Round eta/2, 3eta/2 and mu-eta/2 by nearest ties to even. Calculate absolute and relative errors, test the bound |delta|≤u and explain why a flush-to-zero result for the exactly representable input eta would violate the gradual-underflow absolute bound.
- Here eta=1/32 and mu=1/4=8eta. The target eta/2=1/64 is midway between zero and eta. The even grid integer is zero, so nearest ties to even returns positive zero for this positive input. Its signed error is -1/64, absolute error eta/2, and relative magnitude one.
- The target 3eta/2=3/64 is midway between eta and 2eta. Their grid integers are one and two, so the chosen result is 2eta=1/16. Its signed error is 1/64 and its relative magnitude is (1/64)/(3/64)=1/3. The target mu-eta/2=15/64 lies between 7eta and 8eta, and the even upper integer gives mu=1/4. Its error is again 1/64 and relative magnitude 1/15.
- All three exact targets lie below mu. Their relative errors exceed u=1/16, including the last case whose rounded result is normal. Thus normality of the stored answer is not the premise needed for the normal exact-result model. Each case does meet the gradual-underflow absolute bound eta/2; the mixed bound u|x|+eta/2 is safe as well.
- The input eta itself is exactly representable, so gradual nearest rounding fixes it with zero error. A flush-to-zero contract that instead returns zero has absolute error eta, larger than eta/2, and relative error one. This does not contradict the gradual-underflow theorem: its behavior was changed. The example makes no automatic claim about underflow flags or a particular runtime; those require the specified operational contract.
The three nearest results are 0,1/16,1/4. Each absolute error is 1/64, with relative magnitudes 1,1/3,1/15; the normal u=1/16 bound fails for all three exact subnormal-sized inputs. Flushing the exactly representable eta to zero changes the contract.
Associativity and exact subtraction
Use the same toy format to compare fl(fl(8+1/2)-8) with fl(fl(8-8)+1/2). Separately subtract the floating inputs 9/8 and 1 and explain Sterbenz exactness. Finally start from exact real inputs 17/16 and 1, round them first and explain why exact machine subtraction does not recover their original real difference.
- At eight the toy spacing is one, and 8+1/2 is the midpoint between significand integers 8 and 9. Ties to even selects eight. The next subtraction is exact and returns zero. In the other tree, 8-8 is exactly zero and its addition with the represented 1/2 returns 1/2. The different results follow from fully specified finite, in-range roundings.
- The represented values 9/8 and 1 are nonnegative and within a factor of two, so Sterbenz applies. Their exact difference 1/8 is four subnormal quanta and is represented exactly with gradual underflow. Cancellation has not introduced a subtraction error in this case. Its small result does not by itself make the operation inaccurate.
- Now take exact real data 17/16 and 1. The first is the midpoint between 1 and 9/8, so its initial conversion returns 1; the second is already exactly represented. Subtracting those stored values returns zero exactly. The original real target difference was 1/16, also a representable result if it had been calculated from the original exact data. The lost information was in the input conversion, not an inability to store that final magnitude.
- The conversion error of the first input is -1/16, with relative magnitude 1/17, yet the final difference has relative error one. This is the difference-sensitivity mechanism. An exact stored subtraction and a valid small local relative conversion error therefore do not constitute a forward relative guarantee for the original nearly canceling data problem.
The two orders return 0 and 1/2. The stored subtraction 9/8-1 is exactly 1/8, while first rounding the real input 17/16 to 1 makes its later subtraction from 1 exactly zero and loses the original difference 1/16.
A rationalized square-root difference
In the same toy format, set x=1/16. Evaluate sqrt(1+x)-1 and x/(sqrt(1+x)+1) with a rounding after each indicated operation and a correctly rounded square root. Give both computed answers. Bound the exact real target between 2/65 and 1/32, and use these rational bounds to compare the two errors without confusing a zero result with an exact zero target.
- The represented x is 1/16. In the toy format, 1+x=17/16 is a nearest-even midpoint and becomes one. A correctly rounded square root of one is one, so subtracting one returns zero. The exact real target f=sqrt(17/16)-1 is positive. A zero computed answer is not evidence that this target was zero.
- For the rationalized path, the same rounded square-root subexpression equals one, so its addition with one gives the exact representable denominator two. Division of x=1/16 by two gives 1/32=eta, which is exactly represented as the least subnormal. No extra denominator singularity appears, and the exactness claim follows from the explicit grid rather than a normal relative-error assumption for this tiny result.
- For a positive x, one has 1<sqrt(1+x)<1+x/2: the upper inequality follows by squaring the positive upper bound and noting its extra x²/4. At x=1/16 the rationalized exact denominator lies strictly between 2 and 65/32. Therefore 2/65<f<1/32. The computed eta exceeds f by less than 1/32-2/65=1/2080.
- Dividing that upper error bound by the strict lower target bound 2/65 gives relative error less than 1/64. The direct zero has relative error exactly one. Moreover the exact target is between eta/2 and eta, so eta is its correctly rounded toy value in this particular case. These rational inequalities establish the comparison without using an approximate square-root decimal or claiming universal correct rounding of the rationalized algorithm.
The direct rounded expression gives 0, while the rationalized expression gives eta=1/32. The exact target lies strictly between 2/65 and 1/32, so the rationalized absolute error is less than 1/2080 and relative error less than 1/64; the direct relative error is one.
One rounding instead of two
In binary64 with nearest ties to even, let a=1+2^(-27), b=1-2^(-27) and c=-1. Compute fl(fl(ab)+c) and fma(a,b,c). Prove every midpoint/range assertion and explain why an ordinary source expression is not automatically a promise of fused evaluation.
- Both a=1+2^(-27) and b=1-2^(-27) are exactly represented at binary precision 53, and their exact product is 1-2^(-54). The lower binade just below one has spacing 2^(-53). Its top value is 1-2^(-53), so the product is the exact midpoint between that value and one.
- The normalized integer significand at one is 2^52, which is even. The predecessor’s significand is 2^53-1, which is odd. Nearest ties to even therefore rounds the product to one. Adding the represented c=-1 then gives zero exactly. This establishes fl(fl(ab)+c)=0 without estimating any decimal expansion.
- The exact combined expression is ab+c=-2^(-54). It lies far inside the binary64 normal range and is exactly representable, so one correctly rounded fused multiply-add returns that value. None of a,b,c, the rounded product or the final fused residual suffers overflow or a problematic underflow. The fused result is exact for these data because the combined target itself is represented.
- An ordinary programming expression a*b+c may specify or permit separate rounding, contraction to fusion or another context-dependent behavior. The example has compared two explicit mathematical contracts, not measured an unnamed implementation. It also does not show that every fused result is exact or that wider/fused arithmetic can recover previously rounded input data.
Separate rounding gives zero, while the correctly rounded fused operation gives the exact normal value -2^(-54). The difference is due to an exact product midpoint followed by cancellation.
Compensation does not mean exact summation
In the first toy format sum the inputs 8,1/4,-8. Show the ordinary left-to-right result and the Kahan updates y=fl(x-c),t=fl(s+y),c=fl(fl(t-s)-y),s=t, starting with s=c=0. Then use Neumaier compensation, with its magnitude branch and final fl(s+c), and explain the different result and the limits of a general exactness claim.
- For ordinary left-to-right addition, fl(8+1/4)=8 because the spacing at eight is one and the quarter is below the midpoint. The final subtraction of eight returns zero. In Kahan form, the first input gives y=8,t=8,c=0,s=8. The second gives y=1/4,t=8,c=fl(0-1/4)=-1/4,s=8. Every listed value is represented.
- For the final input -8, Kahan forms y=fl(-8-(-1/4))=fl(-31/4). Immediately below eight the spacing is 1/2, so -31/4=-7.75 is a midpoint between -8 and -7.5; even parity selects -8. Thus t=fl(8-8)=0 and c=fl(fl(0-8)-(-8))=0. The returned s is zero despite the carried correction before this update.
- For Neumaier, retain the old sum when computing t=fl(s+x). The first input gives t=8 and zero correction. At x=1/4, the branch |s|≥|x| gives the low part fl(fl(s-t)+x)=1/4, so c becomes 1/4 while s remains eight. At the last input -8, t=0 and the same magnitude branch gives fl(fl(8-0)-8)=0. Hence s becomes zero, c stays 1/4 and final fl(s+c)=1/4.
- The exact mathematical sum is 1/4. These complete updates exhibit one case where Neumaier keeps information that the given Kahan path loses. They do not prove universal exactness of Neumaier or contradict a valid Kahan absolute-error theorem: such a theorem is a bound, includes the scale sum|xi| and has its stated assumptions. A compensation accumulator and its final addition can round on other inputs.
Ordinary summation and the stated Kahan updates return zero; Neumaier compensation returns the exact sum 1/4. The Kahan low correction is itself lost when forming the last corrected input.
A rigorous but nonsharp sum bound
For the same three exact floating inputs 8,1/4,-8, derive gamma_2 when u=1/16 and the bound gamma_2 times the sum of input absolute values. Compare that bound with the actual left-to-right error. Explain why a large relative condition factor is not itself proof that every evaluation order is inaccurate.
- There are three represented inputs, so sequential summation after the initial assignment has two rounded additions. With u=1/16, gamma_2=(2u)/(1-2u)=(1/8)/(7/8)=1/7. The required condition 2u<1 holds. Both exact nonzero addition results in the considered path are normal-sized; an exact zero result uses delta=0.
- The sum of absolute input values is 8+1/4+8=65/4. Therefore the proved absolute bound is (1/7)(65/4)=65/28. The exact sum is 1/4, whereas the left-to-right result is zero, so its actual absolute error is 1/4, strictly below that bound. The bound is safe and nonsharp, not a forecast that the error will nearly equal it.
- The relative sum condition factor is (65/4)/(1/4)=65, giving the correspondingly loose relative bound 65/7. The observed relative error is one. This does not conflict with unit round-off: u bounds appropriate local operation errors, while the final target is a small cancellation of much larger terms.
- The order 8,-8,1/4 first cancels to zero exactly and then returns 1/4 exactly. Its target and condition factor are unchanged, and the same safe sequential upper bound still applies. Thus sensitivity and an upper bound do not force equal or large observed errors for every tree. A numerical accuracy claim should identify whether it is a worst-case guarantee or the exact outcome of a particular calculation.
Here gamma_2=1/7 and the absolute sequential-sum bound is 65/28. The observed left-to-right absolute error is only 1/4, with relative error one; another order is exact despite the same condition factor 65.
Horner, fusion and a multiple root
Use binary precision four with emin=-4, emax at least two and gradual underflow; this is an explicitly wider low-end range than the first toy format. Evaluate x²-2x+1 at x=9/8 by ordinary Horner, fused Horner and the factored expression (x-1)². Give every rounded intermediate and the exact real value, retaining the subnormal range condition.
- The exact value at x=9/8 is (x-1)²=(1/8)²=1/64. In this example p=4 but emin=-4, so mu=1/16 and eta=1/128. This is a different low-end range from the first toy format. The value 1/64 is two subnormal quanta and is therefore exactly represented; in the earlier format it would have been a midpoint at the bottom and could not support the same conclusion.
- Ordinary Horner first computes fl(fl(1·x)-2)=-7/8 exactly. Its next product is the exact real value -63/64. The neighbors are -1 and -15/16, with distances 1/64 and 3/64, so the rounded product is -1. Adding one returns zero. The absolute error is 1/64 and the relative error for the nonzero target is one.
- Fused Horner has the same first value -7/8, then computes fma(-7/8,9/8,1). The exact combined result is 1/64, so the specified fused operation returns it exactly in this range. It is not necessary to store the separately rounded product -1. The decisive claim is the verified representability of the combined target, including its subnormal position.
- The factored path computes fl(x-1)=1/8 exactly by nearby-input subtraction, and its square is the exactly represented 1/64. Thus it also returns the target exactly. These results compare explicit paths for one sensitive expanded polynomial; they do not assert that every factorization or fused evaluation is always best. A generic normal-domain error theorem must not be applied to a tiny result without checking its premises or its actual exactness.
Ordinary Horner returns zero; fused Horner and the factored expression return the exact target 1/64. The explicitly extended range has eta=1/128, so that tiny target is representable.
A norm whose naive squares overflow
Assume binary64 correctly rounded basic operations and square root. Set a=3·2^600 and b=4·2^600. Explain the naive overflow of a²+b², then evaluate m sqrt((a/m)²+(b/m)²) with m=max(|a|,|b|). Prove which intermediates and final result are exact and finite, and retain the zero-m branch for the general formula.
- Normalize the inputs as a=(3/2)·2^601 and b=2^602. They and the target (5/4)·2^602 lie within binary64’s normal exponent range. Their squares, however, are 9·2^1200 and 16·2^1200, with leading exponents 1203 and 1204. They exceed the finite binary64 range, so a naive square-add-square-root path encounters overflow before reaching a finite final mathematical norm.
- Choose m=max(|a|,|b|)=4·2^600. Division gives a/m=3/4 and b/m=1 exactly; both are short binary fractions and the power-of-two scaling is in range. Their squares are 9/16 and one, and the exact sum is 25/16. All these values have very few significant bits compared with precision 53, so correctly rounded operations retain them exactly.
- The positive square root of 25/16 is 5/4, also exactly represented. The final multiplication (4·2^600)(5/4)=5·2^600 is finite and has an exact short significand. Thus every stated scaled intermediate and the final answer is exact under the explicit operation contracts. This is stronger evidence for this example than merely observing a decimal close to the expected norm.
- For the general formula m=0 requires the separate zero-input branch, and infinities or NaNs need their own contract. With other finite inputs a tiny ratio or its square may underflow, and later operations may round or the true norm may itself be too large. Scaling protects dynamic range in the demonstrated situation; it does not automatically prove universal correctly rounded hypot behavior or a performance claim.
The naive separate squares overflow, but the scaled path has exact intermediates 3/4,1,9/16,25/16,5/4 and returns the exact finite norm 5·2^600.
Two nearest roundings need not compose
Use binary precision three as the final format and precision four as an intermediate format, with ranges containing every value. For the exact rational input 37/32, compare direct nearest-ties-even rounding with the result of first rounding to precision four and then to precision three. Derive both neighboring pairs and their midpoint parities.
- In final precision three near one, adjacent values are 1 and 5/4, with integer significands four and five. Their midpoint is 9/8=36/32. The exact input 37/32 lies strictly above it, so direct nearest rounding selects 5/4. No tie rule is needed for that direct decision.
- In intermediate precision four the values 9/8 and 5/4 are adjacent. The distance from 37/32 to 9/8 is 1/32, while its distance to 5/4 is 3/32. The first rounding therefore produces 9/8 exactly. The extra bit has placed the intermediate at a midpoint of the final format.
- When 9/8 is rounded to precision three, even parity selects the lower endpoint one because its significand integer four is even and the upper integer five is odd. The two-stage result is therefore one. Its signed error against 37/32 is -5/32, compared with the direct rounding error 3/32.
- All values fit the stipulated exponent ranges. This is a counterexample to composing different nearest-precision maps, not to idempotence of one fixed rounding map. Extra precision can still help many calculations, and special rounding policies can avoid specific double-rounding problems. Those claims require their own hypotheses instead of following from the descriptive phrase higher precision.
Direct precision-three rounding of 37/32 is 5/4. Rounding first to precision four gives 9/8, then precision three ties to the even endpoint 1.
Try it yourself
For an IEEE-shaped toy encoding with one sign bit, three exponent bits of bias three and two fraction bits, derive precision, emin, emax, eta, the least normal and largest finite values, epsilon and unit round-off. Count finite real values separately from finite encodings, and count infinity and NaN encodings.
Show the answer and reasoning
The format has p=3, emin=-2, emax=3, eta=1/16, mu=1/4, Fmax=14, epsilon=1/4 and u=1/8. There are 55 finite real values but 56 finite encodings, two infinity encodings and six NaN encodings.
The three exponent bits have interior field values one through six, giving exponents -2 through three after subtracting bias three. Two fraction bits give significand integers m=4,5,6,7, so normal precision is three. The least normal is 4·2^(-4)=1/4, and the greatest is 7·2^(3-2)=14. At the zero exponent field, fraction integers one, two, three give positive subnormal magnitudes 1/16,2/16,3/16, so eta=1/16. Around one the normal gap is 2^(1-3)=1/4; that is epsilon under the stated successor-gap definition, while nearest unit round-off is half of it, u=1/8. There are six times four, or 24, positive normal magnitudes and three positive subnormal magnitudes. Including their negatives and one real zero gives 2·27+1=55 ordinary finite real values. Counting both signed-zero encodings instead gives 2(24+4)=56 finite encodings. The extra encoding is not an additional nonzero magnitude. For each sign the all-one exponent field with zero fraction supplies one infinity. Its three nonzero fraction fields supply three NaN encodings per sign, hence two infinities and six NaNs overall. The totals 56+2+6=64 agree with all six-bit encodings. The problem does not assign a real number or a universal payload-propagation rule to each NaN encoding.
In a finite binary format, determine which of 1/8,3/10,7/20,5/32,1/3 and 1/5 can have an exact representation before imposing a precision/range limit. Then check 1/8 and 5/32 in binary precision four with emin=-2, including their normal or subnormal status. Prove the denominator criterion rather than inspecting decimals.
Show the answer and reasoning
Only 1/8 and 5/32 among the listed fractions have finite binary expansions. In the specified precision-four format with emin=-2, both are exactly represented subnormals, respectively four and five quanta of 1/32.
For a reduced rational a/b, a finite binary expansion implies a denominator dividing a power of two, because multiplying by a sufficient power of two moves the radix point to an integer. Conversely, if b divides 2^k, multiplication by 2^k produces an integer and its binary digits give a finite expansion. Since a and b are coprime, a factor other than two in b cannot disappear through a different expansion. The fractions 1/8 and 5/32 have denominators 2^3 and 2^5, so they pass this unlimited-expansion test. The reduced denominators of 3/10,7/20 and 1/5 contain five, while 1/3 contains three. They cannot have exact finite binary expansions, independently of the precision selected. The finite toy format has mu=1/4 and eta=1/32. Thus 1/8=4eta and 5/32=5eta lie below mu on its permitted subnormal grid. Both are exact even though their normalized exponents would be below the least normal exponent. They should not be incorrectly rejected by applying only the normal-number range. The denominator test alone would not guarantee membership in an arbitrary finite format: more significant digits or a wider range can be required. Here the explicit grid provides that additional certificate. No inspection of rounded decimal output is needed, and the represented subnormal values still carry a different relative-precision scale from normal values near one.
In binary precision four, find the neighbors immediately below and above 1 and round 31/32 by nearest ties to even. Compare the two spacings at the binade boundary and explain why one fixed symmetric ulp interval at 1 is misleading.
Show the answer and reasoning
The predecessor of one is 15/16 and its successor is 9/8. The lower and upper gaps are 1/16 and 1/8. The midpoint 31/32 rounds to one by even parity.
At one in binary precision four, the exponent-zero spacing is 2^(-3)=1/8, so its successor is 9/8. Immediately below one the exponent is -1 and the spacing is 2^(-4)=1/16, giving the predecessor 15/16. Both sides follow the same precision rule applied to different binades. The target 31/32 is exactly halfway between 15/16=30/32 and one=32/32. The predecessor has normalized significand integer 15, odd, whereas one has integer 8, even. Nearest ties to even therefore selects one. The signed error is 1/32 and relative magnitude 1/31. The midpoint above one, between one and 9/8, is 17/16 rather than 33/32. Thus one’s nearest-rounding interval has different half-widths below and above: 1/32 and 1/16. Under ties to even this even endpoint wins both boundary ties. A supposed symmetric absolute grid at one would misidentify one of those boundaries. A valid general half-gap statement always uses the actual bracketing neighbors. The precision-four unit round-off u=1/16 is a uniform normal relative bound, not a definition of one symmetric absolute distance on every part of the number line. The computed relative error 1/31 is consistent with that bound.
In binary precision four, round 23/20 and -23/20 under nearest ties to even and the three directed modes, in a sufficient range. Compute exact signed errors and the relative error of the nearest result.
Show the answer and reasoning
For 23/20, nearest/downward/toward-zero give 9/8 and upward gives 5/4. For -23/20, nearest/upward/toward-zero give -9/8 and downward gives -5/4. Nearest error magnitude is 1/40 and relative magnitude 1/46.
The positive target lies between 9/8=45/40 and 5/4=50/40, while 23/20=46/40. Its distances are 1/40 and 4/40=1/10. Nearest selects 9/8 with signed error -1/40; there is no tie. Downward and toward-zero also choose 9/8 for this positive value, so their signed errors are -1/40. Upward chooses 5/4 with signed error 1/10. The normal-domain range is sufficient by assumption and introduces no exceptional result. For the negative target the endpoints are -5/4 and -9/8. Nearest selects -9/8 with signed error 1/40. Upward and toward-zero select the same value, while downward chooses -5/4 with signed error -1/10. Reflection swaps the directed roles; it does not change the nearest absolute error. The nearest relative magnitude is (1/40)/(23/20)=1/46. The larger directed relative magnitude is (1/10)/(23/20)=2/23. They satisfy the conventional u=1/16 and 2u=1/8 bounds, respectively. These exact values distinguish a valid upper bound from the particular signed error actually obtained.
For a gradual-underflow binary format with least subnormal eta, round eta/4 by nearest ties to even. Calculate its relative error, test the normal multiplicative model and give a valid absolute or mixed error bound. Contrast this with flushing the exactly representable eta to zero.
Show the answer and reasoning
The target eta/4 rounds to zero with relative error one and absolute error eta/4. The gradual-underflow bound eta/2 is valid; the uniform normal |delta|≤u model is not. Flushing eta itself to zero changes that bound’s contract.
The exact positive input eta/4 lies below the midpoint eta/2 between zero and the least positive subnormal. Nearest rounding therefore selects zero without a tie. Its signed error is -eta/4, its absolute error is eta/4 and its relative magnitude is one. A multiplicative representation fl(x)=x(1+delta) for this nonzero x requires delta=-1. It cannot satisfy the normal bound |delta|≤u when u<1. The input is in the subnormal-sized exact-result region, so the failed premise is identified rather than treated as a contradiction to nearest rounding. The absolute inequality |fl(x)-x|≤eta/2 is valid on this small uniform grid. The more general mixed estimate u|x|+eta/2 is also safe and can be propagated through a suitably proved algorithm bound. It should not be simplified back to a small uniform relative error when x approaches zero. The represented input eta is a different test: gradual nearest rounding fixes it exactly. A flush-to-zero result has error eta, exceeding eta/2. That output follows a changed subnormal contract, not the gradual one used in the proof. No inference about a specific machine’s modes or flags is made merely from the mathematical format.
In the first worked toy format, start a floating counter at 8 and repeatedly assign x=fl(x+1/2) while x<10. Determine what happens at the first update and explain which exact-integer/spacing facts make the loop unsafe. Do not claim that every larger integer is unrepresentable.
Show the answer and reasoning
The first update rounds 8+1/2 back to eight, so the specified loop never advances and its condition stays true. This is a spacing/tie issue, not integer overflow or an inability to represent the larger bound ten.
In the toy format, eight has exponent three and significand integer eight, with spacing one. The exact update 8+1/2 is a midpoint between represented integers eight and nine. Ties to even returns eight, so the stored counter after the first update is unchanged. Repeating the same deterministic assignment from the same value returns eight at every update. Since eight is less than the represented bound ten, the specified while condition remains true. This is a proof of stagnation under the given arithmetic contract; it is not a request to execute an unbounded loop or a runtime observation. The value nine and the bound ten are both exactly represented in this toy format. Their existence does not force a half-unit update to reach them. The analogous unit-increment phenomenon occurs at 2^p in formats whose exponent range includes it, because the next integer is a nearest-even midpoint at spacing two. The present example is the scaled gap mechanism inside its smaller stated range. One must distinguish consecutive-integer representability, the size of an increment and fixed-width integer overflow. Many larger values can be exact multiples of a larger spacing, so it would be false to declare every larger integer unrepresentable. A loop proof needs a progress guarantee for its actual stored update and a separately valid range argument.
Subtract floating inputs 3/2 and 5/4 exactly in binary precision four with gradual underflow and sufficient range. State Sterbenz hypotheses. Then explain why applying that theorem after input rounding does not bound the original real-data difference without an input-error term.
Show the answer and reasoning
The floating subtraction is exactly 1/4. Sterbenz controls the arithmetic on the represented operands; errors in converting the original real inputs must be added separately.
Both operands are positive binary floating values: 3/2=(12)·2^(-3) and 5/4=(10)·2^(-3) at precision four. Their ratio is 6/5, between one half and two. The exact difference is (12-10)·2^(-3)=1/4. It lies in the stated sufficient range and is itself representable, so rounding changes nothing. The binary Sterbenz lemma says that floating operands x,y with y/2≤x≤2y have an exactly representable difference when the format and gradual-underflow range permit it. One may state it for nonnegative operands; applying the corresponding same-sign statement with an overall sign handles negative operands. Opposite signs do not give the same cancellation situation. No claim about an arbitrary subtraction outside these hypotheses follows. Let the real inputs be a,b and the stored inputs be a+e_a,b+e_b. Even when their subtraction is exact, the computed result is (a-b)+(e_a-e_b). Its absolute error relative to the original desired difference is therefore at most |e_a|+|e_b|. Under independent normal nearest-conversion bounds this is at most u(|a|+|b|), with an additional subnormal absolute allowance when required. Thus zero rounding error in the subtraction is compatible with a large relative error when a-b is small. For a-b≠0 the conversion contribution is bounded by (|e_a|+|e_b|)/|a-b|; at a=b one must use an absolute statement. The theorem is an exact arithmetic fact about stored operands, not a certificate that measurement or input conversion errors vanished.
In the first worked toy format, compare left-to-right summation of 10,1/2,-10 with the order 10,-10,1/2. Derive a gamma_2 absolute bound and the relative sum condition factor. Explain why the bound and condition factor do not force equal observed errors for both orders.
Show the answer and reasoning
The first order returns zero; the second returns 1/2 exactly. The common absolute bound is 41/14 and the relative condition factor is 41, although the actual errors differ.
In the first toy format, precision is four and u=1/16. The positive numbers 10 and 11 are adjacent in the binade starting at eight. Their midpoint is 10+1/2, and the significand integer ten is even. Consequently fl(10+1/2)=10 and the subsequent subtraction of ten gives zero. The exact real sum is 1/2, so the absolute error is 1/2. In the second order, fl(10-10)=0 exactly, followed by fl(0+1/2)=1/2 exactly. All inputs, intermediates and outputs used in both orders are finite and in range. The exact zero intermediate introduces no relative-error difficulty: the ordinary absolute summation bound includes exact zero operations. For three sequentially summed terms the path length is at most two. Thus gamma_2=(2u)/(1-2u)=(1/8)/(7/8)=1/7. The absolute coefficient sum is 10+1/2+10=41/2, giving |computed sum-exact sum|≤(1/7)(41/2)=41/14. Dividing by the nonzero exact sum 1/2 gives the relative bound 41/7. The sum condition factor is kappa=(41/2)/(1/2)=41. It measures sensitivity to input perturbations and amplifies a worst-case arithmetic bound; it is not the actual rounding error. The first order has relative error one, while the second has relative error zero. Both satisfy the same bound, and neither the condition factor nor the bound forces equality of their observed errors.
Let u=1/100 and n=4 in the rounding-factor model. Prove the bound gamma_4, compare it with the exact products (1+u)^4 and (1-u)^4, and explain how inverse factors are covered. State why n u<1 is a hypothesis rather than a decorative denominator condition.
Show the answer and reasoning
gamma_4=1/24. The all-positive product differs from one by 4060401/100000000 and the all-negative product by -3940399/100000000; both obey the bound, as do products containing inverse rounding factors.
For |delta_i|≤u=1/100, consider four factors, each either 1+delta_i or its reciprocal. Every such factor is at least 1-u and at most 1/(1-u): for reciprocals, 1/(1+u)≥1-u, and for direct factors, 1+u≤1/(1-u). Hence the complete product lies between (1-u)^4 and (1-u)^(-4). Bernoulli’s inequality gives (1-u)^4≥1-4u=24/25>0. Taking reciprocals yields (1-u)^(-4)≤25/24. The product is thus at least 24/25 and at most 25/24. The larger distance from one is 1/24, which is gamma_4=4u/(1-4u). This proof covers mixed direct and inverse factors, rather than assuming all four perturbations have the same sign. The two extreme direct products can also be expanded exactly. (101/100)^4=104060401/100000000, so its excess is 4060401/100000000. Similarly (99/100)^4=96059601/100000000, so its deficit is 3940399/100000000. To compare with 1/24 using integers, their numerators times 24 are respectively 97449624 and 94569576, each less than 100000000. The hypothesis n u<1 ensures that the Bernoulli lower bound 1-nu is positive and can safely be inverted to form a finite positive error bound. If n u≥1 this argument supplies no such gamma certificate; a negative or zero denominator cannot be used as an error allowance. That loss of a bound does not itself prove that any particular computation diverges or has a large error.
In a binary precision-ten model with no range failures, take x=(1,1,1) and y=(1,-1,1/256). Derive the gamma_3 absolute dot-product bound and its relative condition factor. Evaluate the displayed product/sum order exactly and explain why sensitivity is not the same as a necessarily large observed error.
Show the answer and reasoning
The gamma_3 absolute bound is 1539/261376 and the relative condition factor is 513. The displayed ordinary product/sum order nevertheless returns the exact sum 1/256.
At binary precision ten, nearest unit round-off is u=2^(-10)=1/1024. The three exact products are 1,-1,1/256; all are representable. The conventional sequential dot-product path has at most three rounding factors per input product, including its multiplication, so the stated general bound uses gamma_3=3u/(1-3u)=3/1021. The sum of the absolute exact products is 1+1+1/256=513/256. Therefore |computed dot product-exact dot product|≤(3/1021)(513/256)=1539/261376. The exact dot product is 1/256, and its relative condition factor is (513/256)/(1/256)=513. Dividing the absolute bound by 1/256 gives the relative bound 1539/1021. In the displayed order, multiplying each component by one or negative one is exact. The first sum is fl(1-1)=0, and the next is fl(0+1/256)=1/256. The actual forward error of this computation is zero, including its final conversion, under the given range and rounding contract. The condition factor concerns nearby perturbed products, including perturbations that can upset the cancellation of the first two terms. It does not force every representable input and every evaluation order to exhibit a large error. A valid bound larger than the exact answer is still an upper bound; here its looseness records possible perturbation paths rather than a failure of this exact computation.
For a degree-four polynomial under the normal rounding model with u=1/1024, derive the ordinary-Horner gamma_8 and fused-Horner gamma_4 bounds. If the weighted absolute coefficient sum at the input is nine, give both exact absolute bounds and state why a relative bound near a root needs another factor.
Show the answer and reasoning
Ordinary Horner has gamma_8=1/127 and absolute bound 9/127; fused Horner has gamma_4=1/255 and absolute bound 9/255. A relative bound divides these by the magnitude of the nonzero polynomial value.
Write the polynomial as p(x)=sum from i=0 to 4 of a_i x^i and assume the stored coefficients and input are the exact data for this arithmetic analysis. Ordinary Horner performs four multiplications and four additions. Each coefficient contribution follows a path with at most eight rounding factors, giving |computed value-p(x)|≤gamma_8 sum |a_i||x|^i under the normal rounding model and no range failures. With u=1/1024, gamma_8=(8/1024)/(1-8/1024)=8/1016=1/127. The specified weighted absolute sum is nine, so the bound is 9/127. This is an absolute statement in the polynomial’s output units; it does not assume that the polynomial value itself is nine. A correctly rounded fused multiply-add evaluates each Horner stage with one final rounding of the exact product-plus-coefficient. There are four such stages, so the analogous path bound uses gamma_4=(4/1024)/(1-4/1024)=4/1020=1/255 and the absolute bound is 9/255. The smaller worst-case coefficient does not promise that every individual fused evaluation is closer than every ordinary evaluation. If p(x)≠0, the relative bounds are gamma_8 times nine/|p(x)| and gamma_4 times nine/|p(x)|. The factor nine/|p(x)| is the weighted cancellation or coefficient condition factor at this x. It can be arbitrarily large near a root. At an exact root the relative error with this denominator is undefined, so an absolute or suitably scaled residual statement is needed instead. Input and coefficient conversion errors require their own additional analysis.
Use binary precision five with emin=-4 and sufficient upper range. For a=17/16,b=15/16,c=-1, compare separate multiplication-plus-addition with fma. Prove the exact residual is representable in the stated subnormal range.
Show the answer and reasoning
The separate computation gives zero, while fma gives -1/256 exactly. The fused residual equals minus the least positive subnormal of the stated format.
Precision five with emin=-4 has least normal mu=2^(-4)=1/16 and subnormal step eta=2^(emin-p+1)=2^(-8)=1/256. The exact input values 17/16 and 15/16 are representable. Their exact product is (17·15)/256=255/256=1-1/256. Immediately below one, precision-five normal spacing is 1/32, so the neighboring floating values that bracket this exact product are 31/32=248/256 and 1=256/256. Its distances to them are 7/256 and 1/256. Nearest rounding therefore gives fl(ab)=1 without a tie. Separate subtraction of one then gives fl(1-1)=0. A fused multiply-add first forms the exact real quantity ab-1=-1/256 and rounds only once. The magnitude 1/256 is exactly eta, so its signed value is representable as a subnormal. The fused result is consequently -1/256, with no mathematical rounding error under the given gradual-underflow contract. This example explicitly checks the residual’s range and representability. A normal rounded product alone would not ensure that every exact product error fits the destination format: a much smaller residual could underflow or require more available range. The conclusion depends on one fused rounding and gradual subnormals; replacing them with separate operations or flushing the residual to zero changes the computation.
Apply FastTwoSum to a=8,b=1/4 in the first worked toy format. Compute s,z,e, verify the exact real identity s+e=a+b and state which ordering/range assumptions support the general theorem.
Show the answer and reasoning
FastTwoSum gives s=8,z=0,e=1/4. Its two floating outputs have exact real sum 33/4, even though rounding that sum back to one toy value would lose the low part.
FastTwoSum uses s=fl(a+b), z=fl(s-a), e=fl(b-z). With a=8,b=1/4 in precision four, the two neighbors around 8+1/4 are eight and nine, and 8+1/4 is closer to eight. Hence s=8. The subsequent operations give z=fl(8-8)=0 and e=fl(1/4-0)=1/4 exactly. As a real identity, s+e=8+1/4=33/4=a+b. The assertion is about the exact sum of the two outputs, not about fl(s+e). A new nearest rounding of 33/4 to this format would again return eight, which is why the residual must remain separately stored if its information is needed. For the general binary nearest-rounding FastTwoSum theorem, the larger-magnitude-first condition is |a|≥|b|. Rounding precision and evaluation order must be the ones specified by the algorithm, and overflow or unavailable residual range must be excluded. The conservative theorem scope used here keeps all nonzero intermediate quantities and the required residual representable within the certified range; the present example satisfies it. The exact calculations verify this pair but do not prove the theorem for all possible operands. The ordering condition is an essential part of the general result, not a heuristic about likely cancellation. Full TwoSum supplies additional correction operations to handle either magnitude order under its own rounding and range hypotheses.
Apply full TwoSum to a=1/4,b=8 in the first worked toy format, computing s,bb,aa,br,ar,e. Compare with applying FastTwoSum in this wrong magnitude order and explain why the precondition matters.
Show the answer and reasoning
Full TwoSum gives s=8,bb=8,aa=0,br=0,ar=1/4,e=1/4. Wrong-order FastTwoSum gives residual zero and loses the quarter.
Full TwoSum first sets s=fl(a+b), bb=fl(s-a), aa=fl(s-bb), br=fl(b-bb), ar=fl(a-aa), then e=fl(ar+br). For a=1/4,b=8, the rounded sum is s=8. The exact value s-a=31/4=7.75 is the midpoint between 7.5 and eight. Their aligned significand integers are fifteen and sixteen, so nearest ties to even selects eight: bb=8. The remaining correction quantities are aa=fl(8-8)=0, br=fl(8-8)=0, ar=fl(1/4-0)=1/4 and e=fl(1/4+0)=1/4. Each is representable. Thus the two outputs satisfy the exact real identity s+e=8+1/4=a+b, despite the rounding that occurred while constructing bb. FastTwoSum in this same magnitude order also starts with s=8 but then uses z=fl(s-a)=8 and e=fl(b-z)=0. Its resulting real output sum is eight, which differs from a+b by -1/4. This is an explicit counterexample to dropping its larger-magnitude-first precondition. The contrast is consistent with the theorem scopes: here |a|<|b|, so the FastTwoSum guarantee does not apply, while full TwoSum is designed to recover the rounding error without that magnitude order. Correct rounding, the prescribed operation sequence and the stated no-overflow/residual-range hypotheses remain necessary; the longer algorithm does not repeal the floating-point execution contract.
In binary precision four with emin=-4 and sufficient upper range, compute p=fl(ab) and e=fma(a,b,-p) for a=11/8,b=13/8. Verify p+e=ab exactly and state the representability/range condition needed before calling every fused residual an error-free product.
Show the answer and reasoning
p=9/4 and e=-1/64, so their exact real sum is 143/64=ab. The residual is two negative subnormal steps in the specified extended toy range.
The operands a=11/8 and b=13/8 are exactly representable at binary precision four. Their exact product is 143/64. In the binade starting at two the spacing is 1/4, so the bracketing floating values are two and 9/4=144/64. The exact product is only 1/64 from the upper value and 15/64 from the lower, giving p=fl(ab)=9/4. The fused correction forms the exact value ab-p=143/64-144/64=-1/64 before its one rounding. With emin=-4, the least normal is 1/16 and the subnormal spacing is eta=2^(-7)=1/128. Therefore -1/64=-2 eta is exactly representable, and e=fma(a,b,-p)=-1/64. The exact real sum p+e=144/64-1/64=143/64 verifies the error-free two-component representation. Rounding p+e immediately into one precision-four value would generally recover p instead, so the identity is again an exact statement about the pair rather than a promise about a rounded reconstruction. Before extending this argument to a general fused product residual, one must prove that the exact residual fits the available floating range and significand, with no overflow and with the intended gradual-underflow behavior. If a required low part lies below eta or is flushed away, the fused operation can round it and the error-free identity can fail. A finite rounded product by itself is insufficient evidence that its exact error is representable.
With final binary precision four and intermediate precision five, round the exact input 69/64 directly and through the intermediate format. Prove the double-rounding difference using exact midpoint and parity calculations.
Show the answer and reasoning
Direct precision-four rounding gives 9/8, but rounding first to precision five and then to precision four gives one. The intermediate rounding lands exactly on the coarser midpoint.
In the binade from one to two, precision-four spacing is 1/8. Its adjacent values one and 9/8 have midpoint 17/16=68/64. The exact input 69/64 lies just above that midpoint, so direct nearest rounding gives 9/8=72/64. Its direct error is 3/64. At intermediate precision five, the local spacing is 1/16. The exact input is bracketed by 17/16=68/64 and 18/16=72/64, at distances 1/64 and 3/64. Thus the first rounding selects 17/16 without a tie. This first step has error -1/64. On the final precision-four conversion, 17/16 is exactly the midpoint between one and 9/8. At the common exponent scale their significand integers are eight and nine. The even integer eight wins, so the second rounding returns one. Its total error relative to 69/64 is -5/64, and its value differs from the direct result by -1/8. Each conversion separately obeys nearest ties to even. The difference arises because the intermediate conversion removes which side of the coarser midpoint the original value occupied. Additional intermediate precision is therefore not an unconditional guarantee of the same final rounding as a single correctly rounded operation, even when exponent range is ample and neither conversion underflows or overflows.
For stochastic rounding between adjacent values 1 and 3/2 of a binary precision-two format, derive the probabilities that make the rounded value of 13/10 unbiased. Compute the exact variance and both possible errors. Explain why an expectation statement is not a deterministic half-ulp certificate.
Show the answer and reasoning
Choose 3/2 with probability 3/5 and one with probability 2/5. The errors are 1/5 and -3/10, and the exact variance is 3/50.
Let q be the probability of choosing the upper adjacent value 3/2. Unbiasedness requires (1-q)·1+q·(3/2)=13/10. Subtracting one gives q/2=3/10, so q=3/5 and the lower probability is 2/5. These probabilities are nonnegative and sum to one, as required for a valid two-point rule. The upper error is 3/2-13/10=1/5; the lower error is 1-13/10=-3/10. Their weighted mean is (3/5)(1/5)+(2/5)(-3/10)=3/25-3/25=0. Thus the expectation equals the exact input even though neither possible output equals it. Because the mean error is zero, the variance is the mean squared error: (3/5)(1/25)+(2/5)(9/100)=3/125+18/500=3/50. The equivalent adjacent-bracket expression is (x-a)(b-x)=(3/10)(1/5)=3/50, which gives the same result directly. The spacing is 1/2, so its half is 1/4. One possible error has magnitude 3/10>1/4; stochastic rounding therefore lacks a deterministic nearest-rounding half-spacing certificate for each draw. Unbiased expectation, variance and a deterministic error interval are different statements. Claims about repeated or adaptive computations additionally need the relevant conditional randomness assumptions, not just this single-step calculation.
Round each entry of a=(1+2^(-10),1-2^(-10)) to binary precision eight by nearest ties to even, and let b=(1,-1). Compare the exact real dot product with an exact or precision-24 accumulation of the rounded input products, with sufficient exponent range. Explain why the wider accumulator cannot recover the input information already lost.
Show the answer and reasoning
Both low-precision inputs become one, so the accumulated rounded-input dot product is zero. The exact original dot product is 2^(-9); a wider accumulator cannot reconstruct the discarded input difference.
At binary precision eight, the successor of one is 1+2^(-7), so the upper midpoint of one’s rounding interval is 1+2^(-8). Its predecessor is 1-2^(-8), so the lower midpoint is 1-2^(-9). The perturbation 2^(-10) is smaller than either half-gap. Both 1+2^(-10) and 1-2^(-10) therefore round strictly inside the interval to one, without a tie. With the original exact real inputs, the dot product is (1+2^(-10))·1+(1-2^(-10))·(-1)=2·2^(-10)=2^(-9). The exact signed products are close and opposite, so their small nonzero difference contains information in the low input bits. After low-precision conversion, the products are exactly one and negative one. Their exact sum is zero, and a precision-24 accumulation with sufficient range also returns zero exactly. Using an accumulator that makes all subsequent products and additions exact changes nothing about the already converted inputs. The forward error relative to the original real dot product is -2^(-9). It is entirely input quantization error in this example, not an accumulation rounding error. A wider accumulator can reduce new arithmetic losses but cannot infer the two lost signed perturbations from the identical stored pair (1,1). A mixed-precision certificate must account for input conversion as well as accumulation.
What to carry forward
- A floating-point format is a finite representable set with a rounding rule. The spacing at one and unit round-off are different quantities.
- Nearest normal-range relative bounds require their stated range. Gradual underflow instead supplies a useful absolute spacing bound near zero.
- An exactly rounded operation can still receive inaccurate data. Cancellation, conditioning and previous conversion must be analyzed separately.
- Order, fusion, extra precision and underflow behavior are part of an execution contract. Algebraically identical expressions can produce different results.
- Error bounds grow with actual rounded operation paths; pairwise or compensated algorithms need their own hypotheses and do not improve every individual case.
- Error-free transformations represent an exact result by multiple floating values only under their ordering, precision and range conditions.
- Wider accumulation cannot recover information already lost in input conversion. Ideal stochastic unbiasedness does not alone prove a universal root-n error law.
- A useful certificate encloses the intended exact target, accounts for data and rounding, and states its domain, units and implementation requirements.
References
Sources for the concepts and teaching approaches in this article.
- What Every Computer Scientist Should Know About Floating-Point ArithmeticDavid GoldbergResearch exposition
- Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point ArithmeticWilliam KahanLecture notes · PDF
- The Accuracy of Floating Point SummationNicholas J. HighamResearch paper · PDF
- Accurate Sum and Dot ProductTakeshi Ogita, Siegfried M. Rump and Shin’ichi OishiResearch paper · PDF
- Improving the Compensated Horner Scheme with a Fused Multiply and AddStef Graillat, Philippe Langlois and Nicolas LouvetResearch paper · PDF
- When double rounding is oddSylvie Boldo and Guillaume MelquiondResearch paper · PDF
- Stochastic Rounding: Implementation, Error Analysis, and ApplicationsMatteo Croci, Massimiliano Fasi, Nicholas J. Higham, Theo Mary and Mantas MikaitisResearch survey draft · PDF
- Mixed Precision Algorithms in Numerical Linear AlgebraNicholas J. Higham and Theo MaryResearch survey draft · PDF
- Verification methods: Rigorous results using floating-point arithmeticSiegfried M. RumpResearch survey · PDF