Why finite-precision arithmetic can lose a small contribution, change a sum when its order changes, and require a numerical error budget.
Rounding error
Rounding error is the difference between an exact numerical value and the representable value selected by a rounding rule. In floating-point arithmetic, it can enter when an input is stored and when an arithmetic result is rounded back into the working format. The latter is often called roundoff error.
A risk calculation can contain millions of operations, yet its final answer may depend on a small residual. Tiny errors relative to the large intermediate values can matter relative to that residual. The useful question is therefore how rounding affects the quantity being reported, rather than how many digits the screen displays.
One addition can erase a contribution
Consider three synthetic, dimensionless inputs, all exactly representable in IEEE binary64:
a=1016,b=−1016,c=1.
Their exact sum is 1. Suppose every addition rounds its result to binary64 using round to nearest, with halfway cases resolved by choosing the value whose significand has an even final bit. Changing the parentheses changes the answer:
Evaluation
First computed addition
Final result
(a+b)+c
a+b=0 exactly
1
a+(b+c)
b+c rounds back to b
0
Near b, adjacent representable numbers are 2 units apart. The exact intermediate b+c=−9,999,999,999,999,999 is halfway between b and b+2. The ties-to-even rule selects b. Adding a then cancels b exactly, but the contribution from c has already disappeared. Floating-point addition is not associative.
At b equal to minus 10 to the power 16, binary64 floats are two units apart. The exact b plus 1 is halfway and rounds back to b. For a equal to 10 to the power 16, (a+b)+1 gives 1, but a+(b+1) gives 0.
Original synthetic, dimensionless binary64 example under round to nearest, ties to even. The axis uses offsets from b; its spacing is 2. The exact integer sum is 1.
The second order has absolute error1 and relative error1, or 100%, against the exact final sum. This does not mean that one addition incurred a 100% relative error: rounding b+c introduced an error of just −1 against a magnitude close to 1016. Subsequent cancellation exposed it. Catastrophic cancellation explains why errors on large operands can dominate their small difference.
These extreme offsets illustrate a mechanism; they are not portfolio values or market quotes. Real financial calculations need an error assessment at their actual scales.
A local bound is not a final-answer guarantee
For correctly rounded basic arithmetic on stored binary64 operands, with a nonzero normal exact result and no overflow or underflow, the standard model is
fl(x∘y)=(x∘y)(1+δ),∣δ∣≤u,u=2−53≈1.11×10−16,
where ∘ is addition, subtraction, multiplication or division, with a valid divisor. Some operations are exact, so δ can be zero. The model compares one computed operation with the exact operation on its stored operands, which may already carry errors. Zero results need separate interpretation, and the relative bound is not a blanket guarantee for subnormal results or exceptional operations.
Here u is the unit roundoff. Using the spacing convention, machine epsilon is instead
ε=2−52≈2.22×10−16,
the gap from 1 to the next larger binary64 number. Terminology varies between texts, so check which convention a bound uses. Neither number is a universal absolute tolerance: floating-point spacing changes with magnitude.
Keep the error sources separate
Source
What is being approximated?
Would exact arithmetic remove it?
Input representation error
A supplied value, such as decimal 0.1, is stored as a nearby binary value.
Yes, if the intended input can be represented exactly in the chosen arithmetic.
Arithmetic roundoff
An exact operation on stored inputs is rounded to the working format.
A derivative, infinite series or continuous problem is replaced by a finite approximation.
No; the approximation remains.
Model error
The financial model differs from the process or contract it is meant to describe.
No.
Rounding an input is a rounding error too; the first two rows distinguish when it enters. In the three-number example the inputs are exact, isolating arithmetic roundoff. Increasing precision cannot repair a wrong payoff definition, and printing fewer decimal places cannot restore a contribution lost earlier.
Choose the remedy for the calculation
For summation, use an accurate accumulation method rather than assuming a particular order is harmless. In Python, math.fsum([1e16, -1e16, 1.0]) returns 1.0 in the checked binary64 environment. It tracks multiple partial sums to reduce lost information. This is an accuracy tool, not arbitrary exact arithmetic: the official documentation records platform and rounding assumptions, including a possible least-significant-bit discrepancy from double rounding.
For a fragile formula, a reformulation can help more than displaying extra digits; that is a question of numerical stability. For comparisons, select absolute and relative tolerances from the scale and purpose of the result, especially near zero. For a contract that specifies decimal amounts, use suitable decimal or integer-unit arithmetic and apply its explicit rounding rule at the specified stage; binary ties-to-even does not determine the contract's monetary convention.
To connect these choices to hedges and covariance calculations, the Numerical Conditioning and Stability lesson has a public preview, with the full lesson available through membership. It separates errors introduced by computation from the sensitivity of the problem itself.
Sources
Trefethen, L. N., and Bau, D. III. Numerical Linear Algebra. SIAM, 1997, Lecture 13, “Floating Point Arithmetic.”