Section 6.5: Computer arithmetic (Frame 2)                     [prev][home][next]

Let's go through some examples using 8 bit 2's complement arithmetic. First, let's try adding together two small positive numbers:

  0 0 1 1 0 1 0 1     +53
+ 0 1 0 0 0 1 1 1     +71
-----------------    ----
  0 1 1 1 1 1 0 0     124

So far so good. That was easy. Now what about

  0 1 0 1 1 1 1 1     +95
+ 0 1 0 0 1 0 0 1     +73
-----------------    ----
  1 0 1 0 1 0 0 0     168   ???????

But our rules above said that whenever the first bit of a 2's complement number was 1 then the number was negative, so we added two positives, 95+73, and got a negative number?