Solved Problem - Binary Subtraction
Question
Perform the following sums using binary numbers:
- 75-42
- -75-42
- -75-(-42)
Answer
First we choose to use 8-bit true magnitude format. In this format:
| 1. | 01001011 | +75 in true magnitude format | |
| +11010110 | 2's complement of +42 | ||
| ________ | |||
| 00100001 | this is +33 in true magnitude format | ||
| 2. | 10110101 | 2's complement of +75 | |
| +11010110 | 2's complement of +42 | ||
| ________ | |||
| 10001011 | sign bit is 1 so perform 2's complement | ||
| 01110101 | 2's complement of last line | ||
| 11110101 | replace sign bit | ||
| ________ | |||
| 11110101 | -117 in true magnitude format | ||
| 3. | -75-(-42) = -75+42 = 42-75 and so | ||
| 00101010 | +42 in true magnitude format | ||
| +10110101 | 2's complement of +75 | ||
| ________ | |||
| 11011111 | sign bit is 1 so perform 2's complement | ||
| 00100001 | 2's complement of last line | ||
| 10100001 | replace sign bit | ||
| ________ | |||
| 10100001 | -33 in true magnitude format | ||
