Resources | Subject Notes | Computer Science
To understand and implement the process of adding two positive 8-bit binary integers.
An 8-bit binary integer is a whole number represented using 8 binary digits (bits), each of which can be either 0 or 1. This allows for representing numbers from 0 to 255 (inclusive). Each bit position represents a power of 2, starting from the rightmost bit as 20, then 21, 22, and so on.
The process of adding two 8-bit binary integers involves performing binary addition, similar to decimal addition, but using the rules of binary arithmetic. We consider each bit position, starting from the least significant bit (rightmost), and perform the addition and carry operation.
Let's add the binary numbers 10110011 and 01010101:
The final result is 10000100.
Bit Position | Addend (10110011) | Target (01010101) | Sum | Carry |
---|---|---|---|---|
27 | 1 | 0 | 1 | 0 |
26 | 0 | 1 | 1 | 0 |
25 | 1 | 0 | 0 | 1 |
24 | 1 | 1 | 0 | 1 |
23 | 0 | 1 | 0 | 1 |
22 | 0 | 0 | 0 | 1 |
21 | 1 | 1 | 0 | 1 |
20 | 1 | 1 | 0 | 1 |
The sum of 10110011 and 01010101 is 10000100.
Converting the binary numbers to decimal: 10110011 = 187 and 01010101 = 85. Their sum is 187 + 85 = 272. Converting 10000100 to decimal gives 128 + 64 + 4 = 272. Therefore, the addition is correct.