Skip to Content
Navigation:

A stick figure smiling

If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

Image of a comic. To read the full HTML alt text, click "read the transcript".
read the transcript!

### the (64-bit) floating point number line Floating point numbers aren’t evenly distributed. Instead, they’re organized into windows: [0.25, 0.5], [0.5, 1], [1,2], [2,4], [4,8], [8,16], all the way up to [2^1023, 2^1024].

Every window has 2^52 floats in it.

  • between -2 and -1
  • between -1 and - 1/2
  • between - 1/2 and - 1/4
  • between - 1/4 and 0
  • between 0 and 1/4
  • between 1/4 and 1/2
  • between 1/2 and 1
  • between 1 and 2

the windows go from REALLY small to REALLY big

The window closest to 0 is [2-1023 2-1022].

This is TINY: a hydrogen atom weighs about 2^-76 grams.

The biggest window is [2^1023, 2^1024].

This is HUUUGE: the farthest galaxy we know about is about 2^90 meters away.

the gaps between floats double with every window

  • window: [1, 2] gap: 2^-52
  • window: [2, 4] gap: 2^-51
  • window: [4, 8] gap: 2^-50
  • window: [8, 16] gap: 2^-49

why does 10000000000000000.0 + 1 = 10000000000000000.0?

  • In the window [2^n, 2^n+1], the gap between floats is 2^n-52
  • 10000000000000000.0 is in the window [2^53, 2^54], where the gap is 2^1 (or 2)
  • So the next float after 10000000000000000.0 is 10000000000000002.0