Bits, floats, text and encodings
"0.1 + 0.2 is not 0.3" is usually left as a fact to memorise. Here it is a mechanical process over real bits: both numbers are split into a sign, an exponent and a mantissa, the smaller exponent's mantissa is shifted right to line the two up — and the bits that fall off the end during that shift are exactly where the precision goes. The same decomposition, done in general, explains why a float's bit pattern can mean five different kinds of number depending on one field. Two more pages apply the same "look at the real bits" discipline to a signed integer's silent overflow and to the variable-width bytes of UTF-8.
- IEEE 754 additionDecomposes two doubles into sign, exponent and mantissa, aligns them by shifting the smaller exponent’s mantissa right, adds, and rounds — showing exactly why 0.1 + 0.2 is not 0.3.O(1)O(1) space
- IEEE 754 decompositionSplits a double’s raw 64 bits into sign, exponent and mantissa and reconstructs the value — including the special cases (subnormal, zero, infinity, NaN) that are easy to get backwards.O(1)O(1) space
- Two's complementShows a signed 8-bit integer’s binary form, derives negation by inverting every bit and adding one, and demonstrates silent overflow.O(1)O(1) space
- UTF-8Encodes one Unicode character into one to four bytes, with header bits announcing the sequence length and continuation bits carrying the payload — then decodes it back.O(1)O(1) space
Classical algorithms over arrays and graphs live in AlgoLab and Graph algorithms. A state machine over text, of a different kind, is in Regular expressions.