TAOCP Vol 2: Seminumerical Algorithms · Week 60
TAOCP 4.2.4 Distribution of Floating Point Numbers: reading guide
Why leading digits of real-world numbers are not uniformly distributed but follow a logarithmic law (smaller leading digits are more common), and what that means for floating-point error.
Time About 4 hours this week
Why it matters
Benford's law is a famous, surprising result that has real uses, including fraud detection. It also explains why some rounding error estimates are pessimistic.
Before you start
- 4.2.2 Accuracy of Floating Point Arithmetic
- 1.2.2 Logarithms
How to approach it
Download any numeric dataset (populations, file sizes) and check the leading-digit distribution. Then read the explanation.
Exercises
Do every exercise rated 00 to 20 in your head or on paper; they are quick and they check you actually absorbed the definitions. Then pick two or three rated 20 to 25 (M or not) and grind them out fully. Attempt one M25 to M30 and give yourself a hard 90-minute cap before reading the answer. Always read the answer to every exercise you attempted, even the ones you got, because Knuth's answers often teach a second technique.