Why 0.1 + 0.2 Isn't 0.3
In short: a float is 64 stored bits — sign, exponent and mantissa — and most
decimal fractions have no exact binary form, the same way 1/3 has no exact decimal
form. Python stores the double closest to the number you typed, so 0.1 is already a
tiny bit off before any arithmetic happens, and each later + can round again. Never
compare computed floats with ==; use math.isclose (with abs_tol when either side
might be 0), and never store money in a float.

A Quarry user runs a report that sums two price columns and checks the answer
against a stored total. The check fails for a row where the sum is 0.1 + 0.2 and the
total is 0.3. There's nothing wrong with Python. The numbers were never 0.1, 0.2 and
0.3 in the first place. A float is 64 bits laid out in fields, just like Quarry's
record header, and most decimal fractions don't fit in them exactly.
This lesson opens those 64 bits with the same shift-and-mask tools from lesson 2. You'll see what's really stored, why sums drift, and what a storage engine should do about it.
Why 0.1 has no exact binary form
In decimal, 1/3 never ends: 0.333… A fraction ends in base 10 only if its denominator is made of 2s and 5s. In base 2 the rule is stricter: the denominator must be a power of two. 1/10 has a factor of 5, so in binary it repeats forever.
You can generate the binary digits the way you'd do long division. Double the remainder. If it reaches the denominator, the next bit is 1 and you subtract. Trace the first twelve bits of 1/10:
0.0001100110011…, where the block 0011 repeats forever. A float has room for 53
significant bits, so it keeps the first 53 and rounds. The stored 0.1 is the double
closest to 0.1, which is slightly above it.
Try the doubling loop yourself. It draws each bit as it's produced. Change the fraction
to 1, 4 (a power-of-two denominator), 1, 3 or 3, 5, and see which ones finish
and which settle into a repeating pattern:
Your long division in base 2. A denominator that isn't a power of two never reaches remainder 0, so the bits go on forever.