wire / wire-format / fixed-point

Fixed-point number representation

Fixed-point represents real numbers with a fixed number of digits after the radix point. An n-bit fixed-point number with f fractional bits: value = integer / 2^f. Range: -2^(n-f-1) to 2^(n-f-1) - 2^(-f). Common formats: Q15 (16-bit, 15 frac), Q31 (32-bit, 31 frac), Q1.15, Q1.31. Used in DSP, embedded systems, and financial calculations where floating-point is too slow or non-deterministic.

wire-format kind wire-format status standard verification verified tier B wire-format@1

aka: Fixed-point number representation

wire format

spec: Fixed-point arithmetic

Fixed-point represents real numbers with a fixed number of digits after the radix point. An n-bit fixed-point number with f fractional bits: value = integer / 2^f. Range: -2^(n-f-1) to 2^(n-f-1) - 2^(-f). Common formats: Q15 (16-bit, 15 frac), Q31 (32-bit, 31 frac), Q1.15, Q1.31. Used in DSP, embedded systems, and financial calculations where floating-point is too slow or non-deterministic.

fieldsizemeaning
Integer partn-f bitsThe whole number part (including sign bit for signed).
Fractional partf bitsThe fractional part, scaled by 2^f.
Format Qm.nm+n+1 bitsQm.n: m integer bits, n fractional bits, 1 sign bit. Total = m+n+1.
Q15 (16-bit)16 bits1 sign + 0 integer + 15 fractional. Range: -1.0 to 0.99997. Resolution: 2^-15.
Q31 (32-bit)32 bits1 sign + 0 integer + 31 fractional. Range: -1.0 to 0.9999999995. Resolution: 2^-31.
Q8.24 (32-bit)32 bits8 integer + 24 fractional. Range: -128 to 127.99999994. Resolution: 2^-24.

example:

00 00 80 00

Q15 fixed-point: 0.5 = 0x4000, 1.0 = 0x7FFF (max), -1.0 = 0x8000 (min)


provenance

agent: curl -H 'accept: application/json' wire.phall.io/wire-format/fixed-point or /wire-format/fixed-point.json