Numerical methods
You sum ten million small positive numbers in float32. What goes wrong and what fixes it?
AdvancedMultiple choice
- AThe running total grows until new terms fall below its epsilon; use Kahan summation or float64
- BNothing, since the sum is monotone and cannot overflow
- CThe result overflows to infinity
- DSorting the input makes no difference
The worked solution is in Premium
The answer, the full working and the one idea to take away – for this and all 1,322 questions in the bank. Answer it in practice and your working is marked, with a known mistake named when you make one.
Report an issue with this question
Of the kind reported at
Citadel Securities, Two Sigma, Hudson River Trading, Jump Trading
More numerical methods questions
- Where doubles run out of digits, part 3 of 3Advanced · Premium
- What is machine epsilon for IEEE 754 double precision, in units of 10⁻¹⁶, to…Foundation · Premium
- Where doubles run out of digits, part 1 of 3Foundation · Premium
- Why do exchange systems store prices as integer ticks rather than as…Applied · Premium
- In double precision, what does 1 - math.cos(1e-8) evaluate to?Applied · Premium
- Double precision can represent every integer up to 2ᵏ exactly, but not every…Applied · Premium