Binary Addition and Subtraction
Binary Addition and Subtraction
Binary Addition and Subtraction
Example − Addition
0 0 0 1 1 0 1 0 = 26(base 10)
+ 0 0 0 0 1 1 0 0 = 12(base 10)
0 0 1 0 0 1 1 0 = 38(base 10)
00010011 + 00111110 = 01010001 1 1 1 1 1 carries
0 0 0 1 0 0 1 1 = 19(base 10)
+ 0 0 1 1 1 1 1 0 = 62(base 10)
0 1 0 1 0 0 0 1 = 81(base 10)
Here are some examples of binary addition performed on eight-bit unsigned numbers. There's no deep
trick here — just fill out each number to eight bits, and force the sum to fit as well. If it does not fit, this
is considered an “overflow,” and will be accompanied by a one bit carried out of the 128's place, a
“carryout.” With unsigned numbers, overflow and carryout always occur together, though this is not
true for two's complement additions.
1 1 1 1 1 1 1 1
0 1 0 1 0 0 0 1 0 0 1 1 0 0 0 1 1 0 0 1 1 0 1 1
+ 0 0 0 1 1 0 0 1 + 1 1 1 0 0 1 0 0 + 0 1 0 0 1 0 1 0
0 1 1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 1 1 0 0 1 0 1
Example − Subtraction
0 0 1 10 0 1 0 1 = 37(base 10)
- 0 0 0 1 0 0 0 1 = 17(base 10)
0 0 0 1 0 1 0 0 = 20(base 10)
0 0 1 1 0 10 1 1 = 51(base 10)
- 0 0 0 1 0 1 1 0 = 22(base 10)
0 0 0 1 1 1 0 1 = 29(base 10)
Other Examples
Solution:
1 Borrow
1001
101
100
Solution:
1 Borrow
1000
111
0001
Solution:
1 Borrow
1111011.11
1010101.10
100110.01
iv) 11010.101 from 101100.011
0 0 • 1000101 − 101100 =
1 0 1 1 0 1 1 11001:
×1 10 ×1 10 1 1 0
− 1 0 0 1 0 0 1 1
− 1 0 1 0 1 0
1 0 0 1 0 0 1 ×1 ×10 ×10 10 1 0 1
1 0 1 1 0 0
− 1 0 1 100
1 1 001