- #1
DrOnline
- 73
- 0
Homework Statement
Execute the arithmetic operations using 6-bit binary numbers in 2's complement representation.
18+11
(just going to list this first task)
Homework Equations
To convert from regular binary number, from LSB, do not invert initial o's, or first 1, but invert all other values.
+18 = 010010
-18 = 101110
+11 = 001011
-11 = 110101
I understand the thinking of the MSB being, for -18 2's comp: -32, then adding 8, 4 and 2 = -18
The Attempt at a Solution
But I don't know when to use complements.
A)18+11. I get the right answer using two methods:
If I simply add their regular binary values I get 29.
But I also get it right if I add both of their 2's complements, and then complement the answer.
101110
+ 110101
=[STRIKE]1[/STRIKE]100011
answer complements into: 011101 = 29
But now I had overflow, and it still gets it right.
Which of these methods are correct, in accordance with logic, and even more important, in accordance with what was asked in the task?
Seems to me, that using complements in this simply addition of positive numbers, first of all gave me overflow, but also required an additional complementing?
B: When do I have to complement the answers? Is there a logic so I know when to do it?