| 2's Compliment Representation for Signed Integers |
For example,
| Positive Integer 4 | 0000 0100 |
| Compliment of 4 + 1 |
1111 1011 0000 0001 |
| Negative Integer 4 | 1111 1100 |
| Integer | Two's Compliment |
|---|---|
| 3 | 0000 0011 |
| 2 | 0000 0010 |
| 1 | 0000 0001 |
| 0 | 0000 0000 |
| -1 | 1111 1111 |
| -2 | 1111 1110 |
| -3 | 1111 1101 |
| Addition | |||||||
| 5 + (-3): | 0000 0101 | (+5) | |||||
| + 1111 1101 | (-3) | ||||||
| 0000 0010 | (+2) | ||||||
Subtraction |
|||||||
| 3 - 5: | 0000 0011 | (+3) | |||||
| + 1111 1011 | (-5) | ||||||
| 1111 1110 | (-2) | ||||||
Multiplication |
|||||||
| 3 × (-5): | 0000 0011 | (+3) | |||||
| × 1111 1011 | (-5) | ||||||
| 1111 0001 | (-15) | ||||||
Division |
|||||||
| 7 ÷ 3: | 0000 0111 | (+7) | 0000 0100 | (+4) | 7 ÷ 3 = 2 with remainder of 1 | ||
| + 1111 1101 | (-3) | + 1111 1101 | (-3) | ||||
| 0000 0100 | (+4) | 0000 0001 | (+1) | ||||
This page is for INFORMATIONAL PURPOSES ONLY.
Page author: Dawn Rorvik (rorvikd@evergreen.edu)