Prev | Current Page 84 | Next

Carl Reynolds and Paul Tymann

"Schaum's Outline of Principles of Computer Science"


Now here??™s a counter-intuitive observation. How do we represent ??’6? You might think it would be like this:
10000110
That would be incorrect, however. What happens if we add 1 to that representation? We get 10000111,
which would be ??’7, not ??’5! This representation does not work correctly, even in simple arithmetic computations.
Let??™s take another tack. What number would represent ??’1? We can test our idea by adding 1 to ??’1. We
should get 0 as a result. How about this for negative 1:
11111111
That actually works. If we add 1 to that number, we get all zeros in the sum (and we discard the final carry).
CHAP. 3] COMPUTER ORGANIZATION 33
In fact, the correct representation of a negative number is called the ???two??™s complement??? of the positive
value. To compute the two??™s complement of a number, simply change all the zeros to ones and all the ones to
zeros, and then add one. Here is the two??™s complement of 6:
11111001 All the bits of +6 are ???complemented??? (reversed)
+00000001 Add one
11111010 The two??™s complement of 6 = ??’6
You can check to see that this is correct by adding 1 to this representation 6 times. You will find that the
number becomes 0, as it should (ignoring the extra carry off the msb).


Pages:
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
usługi remontowe wycieczki do Skandynawii traktorki ogrodowe skarpetki narciarskie męskie perfumy fm