An Introduction To Floating Point Math
summary
Covers why decimal examples like 0.1 + 0.2 != 0.3 and why 20,000,000 + 1 == 20,000,000 happen, explains normalization vs denormals and how absolute vs relative rounding causes non‑associative addition and multiplication, shows guarantees provided by IEEE 754 binary floats, recommends using wider types first and using Kahan summation (≈3× cost) or logarithms for tiny products, compares bitwise/absolute/relative/ulp comparisons, and warns about platform quirks: Intel 80‑bit intermediates, Go/C++ compile‑time vs runtime math, and FPU rounding mode changes.
AI-written summary · about
chapters (27)
- 0:00Introduction
- 3:33Contents
- 4:40Why are floats weird
- 6:20Scientific notation
- 10:33Relative difference
- 12:47Decimal flows
- 13:56Rounding
- 15:13Recap
- 16:58Guaranteed Results
- 19:57Multiplication
- 23:20Comparison
- 24:27Bitwise Comparison
- 25:03Direct Comparison
- 25:59Absolute Margin
- 27:35Relative Margin
- 28:56Distance
- 30:08Relative Distance
- 31:11Summary
- 32:06Notable Catch 2
- 33:30Limitations
- 34:24IEEE platforms
- 35:26Languages
- 35:55Go
- 37:33C
- 39:55C compilation flags
- 40:38External code
- 42:35Questions
related talks
01h 04mBeyond the Floating Point Computations - What’s New, What’s Useful?
01h 00mProcessing Decimal Values
55mFormatting floating-point numbers
01h 00mSigned integers are two's complement
05mC++ Sorting Pitfalls, UB & Type Conversion Explained
29mintegral types
06mArithmetic in C++ Using Counting Pointers
53mC++ Features You Might Not Know
