Fixed-point converter
Float ↔ fixed in any Q-format. Pick a word width and Q-factor — the integer-bits exponent E, the value range and the LSB follow — then convert a value with your choice of rounding and saturation.
For a signed N-bit type the Q-factor (fractional bits) and the
integer-bits exponent E satisfy E = (N − 1) − Q. Edit
either field — the other follows. Direction picks which way to
convert; both single-value and bulk inputs apply the same
format, rounding, and direction settings live below.
Format
Conversion
Value(s)
Enter a single number for the per-value readout, or two or
more comma- / whitespace-separated values for the table +
plot. Rounding only affects values that can't be represented
exactly at the chosen Q — e.g. ``0.5`` at Q15 is exact, so
every rounding mode gives the same int; try ``0.1`` to see
the rounding pick up 3277 vs 3276.
What the result means
- Range: the smallest and largest float values the format can represent.
- LSB:
2−Q— one integer step expressed as a float. - 1.0 ↔ int:
2Q— the integer that represents 1.0, useful when reading raw memory dumps. - Conceptual integer:
round(x · 2Q)before saturation. May be outside the type's range. - Saturated integer: clamped to
[−2N−1, 2N−1−1]. The SAT flag indicates whether saturation actually fired. - Hex: two's-complement representation in
Nbits (matches what you'd see in a memory dump). - Round-trip: the saturated integer divided back
by
2Q. - Error / LSBs:
round-trip − x, both as a float and as a multiple of the LSB (2−Q).