The IEEE 754 Floating-Point Reference combines a static format table with a
live bit decoder. Type any number and it shows the exact single- and
double-precision bit patterns the way your CPU actually stores them — so you can
see why 0.1 is not really 0.1 and where the sign, exponent and mantissa bits
land in binary32 and binary64.
How it works
IEEE 754 binary formats all share the same structure: one sign bit, a fixed-width exponent field stored with a bias, and a mantissa (also called the significand or fraction). For a normal number the value is:
value = (-1)^sign × 1.mantissa × 2^(exponent − bias)
The leading 1. is implicit (the “hidden bit”) in every format except the x87
80-bit extended, which stores it explicitly. The bias makes the stored exponent
unsigned: it is 2^(expBits-1) − 1, giving 127 for single precision and 1023
for double. Two exponent patterns are special:
exponent = 0 → ±0 (mantissa 0) or subnormal numbers (mantissa ≠ 0)
exponent = all 1s → ±Infinity (mantissa 0) or NaN (mantissa ≠ 0)
The decoder writes your number into an ArrayBuffer with DataView.setFloat32 /
setFloat64, then reads back the raw integer bytes — so the bits shown are the
genuine stored representation, including rounding, not an approximation.
Example and notes
Decode 0.1 and the single-precision mantissa shows a repeating
...11001100 pattern: 0.1 cannot be stored exactly in binary, so it rounds to
the nearest representable value, which is why 0.1 + 0.2 !== 0.3 in most
languages. Compare formats in the table: half precision (binary16) holds only
about 3.3 decimal digits and tops out near 65504, single precision (binary32,
C float) holds about 7.2 digits, and double precision (binary64, JavaScript
Number) holds about 15.9 digits with a range past 10^308. The wider the
exponent field, the larger the range; the wider the mantissa, the more precision.