Section 6.5
Review Questions
Computer arithmetic
-
Which of the following arithmetic operations are done by using the
adder
in some way?
addition subtraction multiplication division
answer...
all of them
-
Perform binary addition on the following two numbers, showing all the
carries...
0 0 1 1 0 1 0 1
+ 0 1 0 0 0 1 1 1
-----------------
answer...
0 0 0 0 1 1 1
0 0 1 1 0 1 0 1
+ 0 1 0 0 0 1 1 1
-----------------
0 1 1 1 1 1 0 0
-
Now add these two numbers, showing all carries:
1 0 1 1 0 1 1 1
+ 1 1 1 0 1 1 1 1
-----------------
answer...
1 1 1 1 1 1 1 1
1 0 1 1 0 1 1 1
+ 1 1 1 0 1 1 1 1
-----------------
1 1 0 1 0 0 1 1 0
-
If we treat the two numbers above as though they were 2's complement
numbers, are they negative or positive?
answer...
negative
-
In general, a bit pattern (string of 1s and 0s) that starts with a 1
is negative in 2's complement. Is it true that if we look at this
bit pattern as an unsigned binary number, it will be larger
than the absolute magnitude of its 2's complement interpretation?
answer...
yes because there is one more bit place for the magnitude
-
If we get a carry out from adding two 2's complement
negative numbers, was there an overflow error?
answer...
no
-
What about if we get a carry out from adding two 2's complement
positive numbers? Is this an overflow error?
answer...
actually, you couldn't get a carry out from adding two positive
numbers because their sign bits would both be 0. There might be
a carry into that sign bit but never out of it.
However, there is overflow.