Series

How Number Representation Works

From Bits to Floating Point — and Everything in Between

Every number in a program is stored as a finite sequence of bits. This series starts with the simplest binary integers and builds up through fixed-point, IEEE 754 floating-point, rounding, precision pitfalls, and arbitrary-precision libraries. By the end, you'll understand why 0.1 + 0.2 !== 0.3 and what to do about it.

How to read this series: Start from the top. Each article builds on the representation introduced in the previous one. By the end you'll have a complete mental model of how computers handle numbers — and where the traps are.
  1. 001
    Beginner Binary Integers

    How computers count with ones and zeros

    12 min
  2. 002
    Beginner Number Bases & Encodings

    From hexadecimal to Base64 — representing values in any radix

    13 min
  3. 003
    Intermediate Fixed-Point Numbers

    Fractions without floating point

    14 min
  4. 004
    Intermediate IEEE 754 Floating Point

    The standard that rules every number in your program

    13 min
  5. 005
    Intermediate Floating-Point Arithmetic

    What really happens when you add two floats

    11 min

Precision & Beyond

What goes wrong with finite-precision arithmetic and what we can do about it.

  1. 006
    Intermediate Precision Pitfalls

    Where floating-point math goes wrong — and how to fight back

    13 min
  2. 007
    Advanced Arbitrary Precision

    When 64 bits aren't enough

    28 min
  3. 008
    Advanced Interval Arithmetic

    Every answer comes with a guarantee

    12 min