• :00Days
• :00Hours
• :00Mins
• 00Seconds
A new era for learning is coming soon Suggested languages for you:

Europe

Answers without the blur. Sign up and see all textbooks for free! Q37E

Expert-verified Found in: Page 256 ### Discrete Mathematics and its Applications

Book edition 7th
Author(s) Kenneth H. Rosen
Pages 808 pages
ISBN 9780073383095 # 37. How is the one’s complement representation of the sum of two integers obtained from the one’s complement representations of these integers?

The answer is almost, but not quite, that to obtain the one’s complement representation of the sum of two numbers, we simply add the two strings representing these numbers using Algorithm 3. Instead, after performing this operation, there may be a carry out of the left-most column; in such a case, we then add 1 more to the answer.

See the step by step solution

## Step 1: We must assume that the sum actually represents a number in the appropriate range.

Assume that n bits are being used, so that numbers strictly between $-{2}^{n-1}\mathrm{and}{2}^{n-1}$ can be represented. The answer is almost, but not quite, that to obtain the one’s complement representation of the sum of two numbers, we simply add the two strings representing these numbers using Algorithm 3. Instead, after performing this operation, there may be a carry out of the left-most column; in such a case, we then add 1 more to the answer. For example, suppose that n=4; then numbers from -7 to 7 can be represented. To add -5 and 3, we add role="math" localid="1668507124663" $1010\mathrm{and}0011$,obtaining $1101$ ; there was no carry out of the left-most column. Since$1101$ is the one’s complement representation of -2, we have the correct answer. On the other hand, to add -4 and -3, we add $1011$ and $1100$, obtaining 1 .The 1 $0111$ that was carried out of the left-most column is instead added to $0111$, yielding $1000$,which is the one’s complement representation of-7. A proof that this method works entails considering the various cases determined by the signs and magnitudes of the addends. ### Want to see more solutions like these? 