I don't understand when 100 appear in add what I should do. what the carry for the next step? They are marked with red and blue colors
1 Answers
Let's go step by step:
000011
001101
011011
+ 110110
--------
First we add the values in the 1's column: 1 + 1 + 1 + 0 = 11
. We carry the 2's column of the result and continue:
1
000011
001101
011011
+ 110110
--------
1
Now we add the values of the 2's column (including the carry): 1 + 1 + 0 + 1 + 1 = 100
. I think this is where your confusion started, because the sum has 3 columns instead of 2. We can just carry both extra columns:
10
000011
001101
011011
+ 110110
--------
01
Continuing on to add the values of the 4's column: 0 + 0 + 1 + 0 + 1 = 10
. We have a 1
to carry over to the 8's column, but there's already a carried 1
there! So we add the two carries: 1 + 1 = 10
. Essentially, we shift the carry in the 8's column over the 16's column:
10
000011
001101
011011
+ 110110
--------
001
We add the 8's column (0 + 0 + 1 + 1 + 0 = 10
) and once again we have a "collision" of our carried values. So just like before, we add the carries, resulting in a "shift":
10
000011
001101
011011
+ 110110
--------
0001
Add the 16's column and carries:
10
000011
001101
011011
+ 110110
---------
00001
After adding the 32's column:
1
000011
001101
011011
+ 110110
---------
100001
All that remains is our carry in the 64's column:
000011
001101
011011
+ 110110
---------
1100001

- 385
- 1
- 8
-
this is for unsigned; "carry" is not typically used for that; we also need to know the range/width – Andrew Jan 14 '23 at 10:47