Addition
Rules of binary addition
0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 10
Example unsigned binary integer
Example 01
0000 0101 ---- 0101
Example 02
1000 0101 ---- 1101
Example 03
11011000 01010110 -------- 100101110
Subtraction
Subtraction rules:
0 - 0 = 0 0 - 1 =-1 1 - 0 = 1 1 - 1 = 0
Examples of signed binary subtractions
Example 01
0101 -0000 ----- 0101
Example 02
0111 -0101 ---- 0010
Example 03
01010110 -11011000 -------- 10000010
Interpreting number is negative or positive
- Observe the sign bit (MSB)
- If ‘0’, the number is positive
- If ‘1’, the number is negative