Fixed Point Addition and Subtraction

Here, we cover addition and subtraction of both signed and unsigned fixed point numbers in detail.

Since the two’s complement representation of integers is almost universal in today’s computers, we will focus primarily on two’s complement operations.

Two’s complement addition and substraction

As we explore the addition of signed numbers, we also implicitly cover subtraction as well, as a result of the arithmetic principle:

$$ a - b = a + (-b) $$

We can negate a number by complementing it (and adding 1, for two’s complement), and so we can perform subtraction by complementing and adding.

Untitled

Computers represent data using a finite number of bits, and as a result can only store numbers within a certain range.

Some experimentation with the number circle shows that numbers can be added or subtracted by traversing the number circle clockwise for addition and counterclockwise for subtraction

Carry

The carry is produced by addition at the highest (leftmost) bit position is discarded in two’s complement addition.

The carry out of the leftmost bit is discarded because the number system is modular —it “wraps around” from the largest positive number to the largest negative number

Although an addition operation may have a (discarded) carry-out from the MSB, this does not mean that the result is erroneous.

Untitled

Untitled