How Fixed-Point Binary Represents Fractional Values
Fixed-point binary representation is a method used by digital systems to store and calculate fractional values without the overhead of floating-point hardware. By assigning a predetermined, unmoving position to the radix point (the binary equivalent of a decimal point), fixed-point notation splits a standard integer bitfield into an integer portion and a fractional portion. This provides predictable precision, consistent execution time, and simple arithmetic operations by treating non-integer numbers as scaled integers.
The Concept of Negative Powers of Two
In the standard binary system, digits to the left of the radix point represent non-negative powers of two (\(2^0, 2^1, 2^2, \dots\)). Fixed-point notation extends this system to the right of the radix point using negative powers of two:
- \(2^{-1}\) = \(0.5\) in decimal
- \(2^{-2}\) = \(0.25\) in decimal
- \(2^{-3}\) = \(0.125\) in decimal
- \(2^{-4}\) = \(0.0625\) in decimal
To represent a fractional decimal value, the system sums the values
of the active fractional bits. For example, the binary fraction
0.1101 evaluates to:
\[(1 \times 0.5) + (1 \times 0.25) + (0 \times 0.125) + (1 \times 0.0625) = 0.8125\]
Fixed-Point Format Notation (Q Notation)
Because physical computer memory stores only continuous sequences of
0s and 1s without an actual decimal point
symbol, the location of the radix point is maintained entirely by
software conventions and hardware designs.
The most common convention is Q notation (or
Qm.n format): * m: The number of bits
allocated to the integer part (sometimes including a sign bit). *
n: The number of bits allocated to the fractional
part.
For instance, an 8-bit Q4.4 format allocates the four
most significant bits to the integer component and the four least
significant bits to the fractional component.
Conversion Example: Decimal to Fixed-Point Binary
Consider representing the decimal number \(6.625\) in an 8-bit unsigned
Q4.4 format:
- Convert the integer portion (\(6\)):
- \(6 = 4 + 2 = 2^2 + 2^1 \rightarrow \mathbf{0110}_2\)
- Convert the fractional portion (\(0.625\)):
- Multiply repeatedly by 2 or break down into negative powers:
- \(0.625 = 0.5 + 0.125 = (1 \times 2^{-1}) + (0 \times 2^{-2}) + (1 \times 2^{-3}) \rightarrow \mathbf{1010}_2\)
- Combine the components:
- In conceptual notation:
0110.1010 - Stored in raw memory as the 8-bit integer:
01101010(which equals decimal106).
- In conceptual notation:
To decode the stored integer back to decimal, divide the raw integer by the scaling factor (\(2^n\)): \[106 \div 2^4 = 106 \div 16 = 6.625\]
Signed Fixed-Point Representation
Signed numbers are typically implemented using Two’s
Complement. In a signed format such as SQ3.4 (1
sign bit, 3 integer bits, 4 fractional bits):
- The most significant bit (MSB) carries a negative weight equal to \(-2^{m-1}\).
- All subsequent bits contribute positive weights.
- Standard two’s complement operations (addition, subtraction, and inversion) remain fully functional without needing custom logic for the fractional part.
Advantages and Limitations
- Performance: Operations use regular integer Arithmetic Logic Units (ALUs), which are faster and require less silicon area than Floating-Point Units (FPUs).
- Determinism: Results are strictly reproducible across different processor architectures, making fixed-point popular in digital signal processing (DSP), audio codecs, and embedded systems.
- Limited Range: Unlike floating-point notation, which dynamically adjusts the exponent to accommodate very large or very small numbers, fixed-point has a rigid dynamic range. Numbers exceeding the allocated integer bits cause overflow, while values smaller than the lowest fractional bit (\(2^{-n}\)) suffer from truncation or rounding errors.