Professional Documents
Culture Documents
Fixed Point Tutorial
Fixed Point Tutorial
Gianluca Biccari
(Email: gb@gianlucabiccari.com)
Binary Format
N binary digits (bit) has 2N states.
There is no an unique meaning inherent in a
binary word, it depends on the representation
and mapping choose.
binary point
Qm.n format: m bit for whole part, n bit for fractional part.
Floating point representation: the position of the point
must be determined at processing time. These
calculations are much slower than fixed point. The
reason for using floating point representation is that the
range of possible values is much greater.
Qm.n format: unsigned fixed point
N = m + n bits
X[B2] = bn+m-1 . . . bn+1 bn bn-1 ... b2 b1 b0
N −1
1
x [B10] = n
2
∑2 b
i =0
i
i
N −2
1
fractional part
adjustment
x [B10]
2
[
= n − 2 N −1 bN −1 + ∑ 2i bi ] x like two’s
complement
i =0
number
2 N −1
x min = − n = − 2 m
2 i.e. : Q2.13
2 N −1 − 1 m − n N = 16 bit
x max = n
=2 −2 range: -22 ÷ (22 – 2-13 ) = - 4 ÷ 3,99987
2 resolution: 1,22 10-4
resolution: 2-n
Float value Qm.n value
From float to Qm.m:
N −2
[
x [B10] 2 n = − 2 N −1 bN −1 + ∑ 2i bi ]
i =0
Example2:
0xFB0EA9BA=(1111 1011 0000 1110 1010 1001 1011 1010)[B2]
Resolution:
is the smallest non-zero magnitude representable, = 2-n
Accuracy:
is the magnitude of the maximum difference between a real
value and its representation, = 2-n/2 = 2-n-1