Tool · number formats
Number format explorer
What does a value look like in FP16, BF16, FP8 and FP4, bit by bit, and what is lost?
How it counts
value = (−1)^sign × 2^(exponent − bias) × 1.mantissa
What does each format actually store?
| Format | Bits: sign · exponent · mantissa | Stored value | Error |
|---|---|---|---|
FP32 the classic float | 00111101110011001100110011001101 | 0.100000001 | 1.5e-6% |
FP16 half precision | 0010111001100110 | 0.0999755859 | 0.024% |
BF16 FP32's range, less precision | 0011110111001101 | 0.100097656 | 0.098% |
FP8 E4M3 8 bits, more precision | 00011101 | 0.1015625 | 1.6% |
FP8 E5M2 8 bits, more range | 00101110 | 0.09375 | 6.3% |
FP4 E2M1 4 bits, 15 values | 0000 | 0 | lost |
BF16, decoded: Sign 0 (positive). Exponent bits 01111011 = 123, minus the bias 127: -4. Mantissa 1.1001101 in binary = 1.6015625. Value = 1.6015625 × 2-4 = 0.100097656. Next number up: 0.100585938, a gap of 0.00048828125 (0.49% of the value).
Click a row to decode it. Rounding to the nearest value, ties to even, with subnormal numbers. FP32, FP16, BF16, and FP8 E5M2 overflow to infinity; FP8 E4M3 and FP4 E2M1 have no infinity and saturate to their largest value. Checked bit for bit against the ml_dtypes library. The Qwen3-8B weight is a real one (layer 10, stored in BF16, hence exact in BF16).