Why 0.1 + 0.2 Doesn't Equal 0.3 - Floating Point Explained
Why does Python tell you that 0.1 + 0.2 = 0.30000000000000004? The answer is IEEE 754 - the floating-point standard baked into every CPU on the planet. In this video we go under the hood: from the limits of fixed-point arithmetic, through scientific notation in binary, to hand-converting 3.14 into its 32-bit IEEE 754 representation - and then proving it in C with a union hack that reads the raw bits directly out of memory. We also look at what happens at the edges: divide by zero, and rather than a crash you get infinity. Divide zero by zero and you get NaN - Not a Number. IEEE 754 doesn't just define the happy path, it defines all the weird paths too. ββββββββββββββββββββββββ π CHAPTERS ββββββββββββββββββββββββ 0:00 The 0.1 + 0.2 Problem 1:01 Fixed-Point Arithmetic 5:57 Scientific Notation & the Birth of Floating Point 6:48 The IEEE 754 Standard 7:01 Converting 3.14 to a 32-bit Float 11:12 Proving it in C 13:24 Edge Cases: Infinity and NaN 15:20 Why IEEE 754 Changed Everything ββ
βhttps://makertube.net/w/o6DgKtxsYbUcueACenFwNc