Binary Addition - 2's Compliment Representation

2 replies · 2K views · last reply
Marcin H
Messages
306
Reaction score
6

Homework Statement


Screenshot of a homework problem titled Binary addition asking for two 8-bit binary additions in unsigned and 2's complement representations, indicating overflow, with five sums listed as 1000 1100 + 0110 1110, 0100 0110 + 0011 1100, 1110 1100 + 1100 1110, 1001 0111 + 0110 1001, and 1011 1010 + 1011 0000.


Homework Equations


Binary Arithmetic

The Attempt at a Solution


Is this the right way to do these problems? If I see a binary 1 at the beginning of the binary number do I just do the 2's compliment of that and add them? I am not too sure what it means by assume numbers are represented in 2's compliment. How do I add them exactly?

Handwritten binary arithmetic on lined paper: 10001100 is complemented to 01110011, plus 1 gives 01110100, then added to 01110110 to give 11100010.
 
Attachments
  • Handwritten binary addition in two's complement on ruled paper, with the step of taking the complement of 10001100 to get 01110011 and adding 1 to form the negative value.
    New Doc 22_1.jpg
    17.6 KB · Views: 609
Marcin H said:

Homework Statement


View attachment 105541

Homework Equations


Binary Arithmetic

The Attempt at a Solution


Is this the right way to do these problems?
You did the 2nd part of problem 1. You still need to do the first part of this problem, and both parts of the other four problems.

Marcin H said:
If I see a binary 1 at the beginning of the binary number do I just do the 2's compliment of that and add them? I am not too sure what it means by assume numbers are represented in 2's compliment. How do I add them exactly?
For the 1st parts of the five problems, the assumption is that they are all unsigned numbers, so you would add them as you normally would binary numbers. As an aside, 8-bit unsigned numbers have a range of 0 through 255 in base 10. Signed 8-bit numbers have a range of -128 through 127, base 10.

For the 2nd parts, the assumption is that they are unsigned numbers. A number with a 1 in the highest bit represents a negative number. If the highest bit is 0, the number is positive or maybe zero.
Marcin H said:
 
  • Like
Likes   Reactions: Marcin H
Marcin H said:
If I see a binary 1 at the beginning of the binary number do I just do the 2's compliment of that and add them?
You just add the numbers. The actual addition of unsigned and 2's complement numbers produces the same result, with the only difference in the detection of a carry for unsigned numbers or overflow for signed numbers.
 
  • Like
Likes   Reactions: Marcin H