Absorption in naive floating-point summation

In IEEE-754 double precision, you sum, left to right, one value of 101610^{16} followed by exactly 10610^{6} (one million) values of 1.01.0. The exact mathematical total is 1016+106=10,000,000,001,000,00010^{16} + 10^{6} = 10{,}000{,}000{,}001{,}000{,}000. What total does the naive running-sum loop actually return? (A double has a 52-bit fraction, so around 101610^{16} its representable values are spaced 22 apart.)

Show hints (2)+
  1. At 101610^{16} the spacing between doubles is 22, so 1.01.0 is below the rounding threshold.
  2. Each 1.01.0 leaves the running sum unchanged - the total stays 101610^{16}.

Answer

Reveal answer →

10000000000000000

Create a free account to see the full worked solution and track your progress.

Interview format: Prop Trading, Systematic & Data-Driven Trading

Related questions