General Formula for Two's-Complement, Integer Fixed-Point Numbers

GUIDE: Mathematics of the Discrete Fourier Transform (DFT). General Formula for Two's-Complement, Integer Fixed-Point Numbers

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.

<< Previous page  TOC  INDEX  Next page >>

General Formula for Two’s-Complement, Integer Fixed-Point Numbers

Let $N$ denote the (even) number of bits. Then the value of a two’s complement integer fixed-point number can be expressed in terms of its bits $\ as

\

We visualize the binary word containing these bits as

\

Each bit $b_i$ is of course either 0 or 1. Check that the $N=3$ table above is computed correctly using this formula. As an example, the numer 3 is expressed as

\

while the number -3 is expressed as

\

and so on.

The most-significant bit in the word, $b_0$, can be interpreted as the “sign bit”. If $b_0$ is “on”, the number is negative. If it is “off”, the number is either zero or positive.

The least-significant bit is $b_{N-1}$. “Turning on” that bit adds 1 to the number, and there are no fractions allowed.

The largest positive number is when all bits are on except $b_0$, in which case $x=2^{N-1}-1$. The largest (in magnitude) negative number is$10\, i.e., $b_0=1$ and $b_i=0$ for all $i>0$. Table 4.5 shows some of the most common cases.


Table 4.5:Numerical range limits in $N$-bit two’s-complement.
$N$$x_{\$x_{\
8-128127
16-3276832767
24-8,388,6088,388,607
32-2,147,483,6482,147,483,647


<< Previous page  TOC  INDEX  Next page >>

 

© 1998-2017 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy