
Sign up to save your podcasts
Or


Why does Python tell you that 0.1 + 0.2 = 0.30000000000000004?
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.
━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━
By Why does Python tell you that 0.1 + 0.2 = 0.30000000000000004?
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.
━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━