A double, one bit at a time

IEEE 754, sixty-four checkboxes.

Sixty-four checkboxes, one for each bit of an IEEE 754 double. Tick them and everything underneath follows. It arrives holding 3.0, and the button puts it back.

What follows is a grid of 64 checkboxes, one per bit, labelled by bit number and by which field it belongs to. Below them is a list giving the raw bytes, the sign, the exponent, the fraction, what kind of value it is, the exact value written as a C hexadecimal float, and an approximate decimal one. Those readouts are drawn by CSS rather than written in the page, so your reader may or may not announce them. It is a toy, there is nothing here you need.

sign bit 63, exponent bits 62 to 52, fraction bits 51 to 0.

Raw
Sign
Exponent
stored, actual
Fraction
Class
Exact
Decimal
. × 10

How it works

The exact line is built out of CSS counters. Counters are integers, so that line is the same in every browser down to the last hex digit.

The decimal line was harder. Firefox evaluates custom properties in single precision, so raising two to the power of the exponent overflows to infinity somewhere past 1e38 and the readout collapses. Going through logarithms instead keeps every intermediate small, and then both browsers agree to six figures across the whole range, subnormals included.

Clear every exponent bit and the leading digit of the exact value flips from 1 to 0, because subnormals have no hidden bit. Set every exponent bit instead and you get an infinity, then tick any one fraction bit to turn that into a NaN. Bit 51 is the one that decides whether it is quiet or signalling.

The one thing it will not do is round. The decimal digits are truncated rather than rounded, so the last figure can sit one low.