CalcWorldHub
Free online calculator · no signup

Fixed-Point Quantization and Saturation Calculator

Quantize a real value into a signed two’s-complement fixed-point word and inspect its range and error.

4,000 tools
Fixed-Point Quantization and Saturation Calculator — Total signed word width W (bits), Fractional bits F, Input real value x and calculation method
Fixed-Point Quantization and Saturation Calculator: inputs and calculation method.

How to use this calculator

Quantize a real value into a signed two’s-complement fixed-point word and inspect its range and error.

  1. Enter Total signed word width W (bits), Fractional bits F, Input real value x. Match the units shown beside each field and review the result together with the assumptions below.
  2. Read the worked example below to check the expected input format and result.
  3. Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Computer science calculation

How this calculation works

A signed fixed-point word stores a scaled integer and treats a selected number of low bits as fractional bits. This calculator uses W total bits and F fractional bits, scales the input by 2^F, rounds ties away from zero, and saturates to the signed W-bit range. It reports the decoded value, raw integer, unsigned two’s-complement code, resolution, error, range, and whether saturation occurred.

Inputs and units

width — Total signed word width W (bits)
Total bits including the sign bit; this calculator supports widths from 2 to 32 bits.
fractionBits — Fractional bits F
Number of low-order bits assigned to the fractional scale; F must be less than W.
value — Input real value x
Real-valued quantity to quantize; values outside the representable range are saturated.

Formula

Displayed formula

scale = 2^F; raw = saturate(roundAwayFromZero(x × scale), −2^(W−1), 2^(W−1)−1); xq = raw/scale.

Method

Compute the power-of-two scale, round the scaled input to the nearest integer with exact half steps rounded away from zero, clamp the raw integer to the signed two's-complement limits, and decode it by dividing by the scale. The unsigned code is raw modulo 2^W.

Worked example

For W = 16, F = 8, and x = 1.2345, scale is 256, raw = 316, the decoded value is 1.234375, and the quantization error is −0.000125.

Assumptions and limits

This is a signed two's-complement format with a fixed half-away-from-zero rounding convention. Hardware libraries can use different word widths, overflow rules, or tie-breaking. Width is limited to 32 bits so the displayed integer codes remain exact in the browser's numeric representation.

Frequently asked questions

How is a real value encoded?

Multiply by 2^F, round to the nearest integer using the stated tie convention, then store that signed raw integer in W-bit two's complement.

What does saturation mean?

If the rounded raw integer falls outside the signed range, it is clamped to the nearest endpoint and the result marks saturation.

Is half-away-from-zero rounding universal?

No. This page states its own rounding rule; target processors and fixed-point libraries may use another rounding or overflow convention.

How do I use the Fixed-Point Quantization and Saturation Calculator?

Enter Total signed word width W (bits), Fractional bits F, Input real value x. Match the units shown beside each field and review the result together with the assumptions below.

What is a worked example of Fixed-Point Quantization and Saturation?

For W = 16, F = 8, and x = 1.2345, scale is 256, raw = 316, the decoded value is 1.234375, and the quantization error is −0.000125.