Sandbox · exhibit 0027

A clock counting from the Big Bang ticks a minute at a time

Every number on this wall — every tide height, every wavelength, every angle a globe is turned through — is a double: one sign bit, eleven of exponent, and 52 bits of fraction. That last number is the whole story. It buys you 4,503,599,627,370,496 numbers between 1 and 2, and exactly the same count between 1024 and 2048, and between 260 and 261. The numbers do not get denser as you go up; the gaps get wider, doubling every time the magnitude doubles. Everything below follows from that one fact.

What 0.1 is

A double is a whole number times a power of two. One tenth is not, so what you get when you write 0.1 is the nearest one that is — and it is not 0.1. This is its exact value, all of it; the expansion terminates because every double is a fraction over a power of two.

·

·

The gap, against the size of the number

Pick any magnitude and the distance to the next double along is fixed by which power of two you are standing on. It is a staircase, one step per doubling, and it climbs through every scale anyone measures anything in.

the gap here where you are standing
magnitude ·

Where counting by ones stops working

Below 253 every whole number is a double. Above it, the gap is 2 and then 4 and then 8, so the odd numbers are simply not there: add one and nothing happens. Every counter that has ever silently stuck was standing on this line.

a number you can hold a whole number you cannot
counting near ·

What it costs, and what it does not

Two arithmetic problems with the same shape: the answer is much smaller than the numbers you got it from, so the error that was too small to see in them is not too small to see in it. Both have a fix that costs nothing.

the plain way the careful way

·

What this page checks about itself

Every one of these is computed here, in the browser, from the bit pattern of the numbers themselves rather than from anything written above. The exact decimal expansions are done in BigInt, so they are not floating point checking floating point.