Finding the one's complement form of a signed integer:
For Example:
0100101 -> 1011010
Finding the two's complement form of a signed integer:
For Example:
Lets find the binary representation of -7 in two's complement.
Another example, lets find -47:
Two's complement conversion table:
| Two's complement Form | Signed Decimal |
|---|---|
| 0000 | 0 |
| 0001 | 1 |
| 0010 | 2 |
| 0011 | 3 |
| 0100 | 4 |
| 0101 | 5 |
| 0110 | 6 |
| 0111 | 7 |
| 1000 | -8 |
| 1001 | -7 |
| 1010 | -6 |
| 1011 | -5 |
| 1100 | -4 |
| 1101 | -3 |
| 1110 | -2 |
| 1111 | -1 |
Key points:
The signed magnitude form represents negative numbers by using the MSB to denote sign. 0 for positive and 1 for negative.
For example:
| Decimal | Signed Magnitude |
|---|---|
| 7 | 0111 |
| -7 | 1111 |
| 47 | 00101111 |
| -47 | 10101111 |
Key points: