Floating-point explorer

Inspect and edit FP8, FP16, FP32 and FP64 bit patterns with ties-to-even rounding.

About this tool

Choose a format and an input type, then Inspect. Each input type has its own draft. Switching format keeps those texts and reinterprets the active text only on the next Inspect action; hex and binary patterns are never silently truncated. A successful inspection keeps the original active text visible and updates the other drafts to canonical representations. Use example and bit toggles update all drafts. Choosing an example alone does not change the pattern.

Decimal input first becomes a JavaScript binary64 Number, then the selected format. This is not an arbitrary-precision decimal converter. Narrowing rounds to nearest, with exact ties choosing the value whose last significand bit is 0. For example, 1.00048828125 rounds to 1 in FP16. Negative zero and the sign of underflow are retained. FP32/FP64 conversion follows the native Number/DataView semantics described by ECMAScript NumericToRawBytes; small formats round directly from binary64 without an FP32 intermediate.

FP8 follows the explicit ONNX Float8 E4M3FN and E5M2 variants, without saturation. E4M3FN has no infinity: its maximum is 448, raw 0x78 is 256, and only exponent 1111 with fraction 111 is NaN. 464 still rounds to 448; larger magnitudes round to NaN. Infinity input also becomes NaN. E5M2 overflows to infinity at 61440, FP16 at 65520. Numerically entered NaN uses a canonical positive pattern; inspecting or toggling raw patterns preserves their payload and sign bits.

Input is limited to 256 characters, including outer spaces. Decimal syntax accepts one dot or comma, a sign and an exponent, plus case-insensitive NaN, Infinity and Inf; the infinity tokens allow a sign. A finite decimal that overflows binary64 is rejected; tiny values can round to signed zero. Output uses shortest roundtrip Number text with a decimal dot. Hex may start with 0x and binary with 0b. Only outer spaces are allowed; no internal spaces, separators or ignored characters. Short raw patterns are left-padded; excessive width, including leading zeros, is an error.

Normal values have an implicit leading 1; subnormals have a leading 0 and effective exponent 1 − bias. Zero, infinity and NaN have no normal significand decomposition. Small drafts use existing cookie storage; a draft that cannot be encoded or exceeds 1,500 encoded characters remains available only until reload, with a visible notice. Results are not restored automatically.