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".

browse more comics! get the zine!
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 - 12 - between - 12 and - 14 - between - 14 and 0 - between 0 and 14 - between 14 and 12 - between 12 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

Saturday Morning Comics!

Want another comic like this in your email every Saturday? Sign up here!

I'll send you one of my favourite comics from my archives every Saturday.
© Julia Evans 2024 | All rights reserved (see the FAQ for notes about licensing)