-
Quite simple idea: to represent negative number,
-
Take positive number,
-
Set leftmost bit equal to 1.
-
Flip the bits of positive number.
-
For example,
5 = 0000 0101
-5 = 1111 1010
-
Unfortunately, this too requires cumbersome hardware to do further addition.
|
-
8 bit ones' complement:
Binary value |
Ones' complement interpretation |
Unsigned interpretation |
00000000 |
0 |
0 |
00000001 |
1 |
1 |
... |
... |
... |
01111101 |
125 |
125 |
01111110 |
126 |
126 |
01111111 |
127 |
127 |
10000000 |
-127 |
128 |
10000001 |
-126 |
129 |
10000010 |
-125 |
130 |
... |
... |
... |
11111110 |
-1 |
254 |
11111111 |
-0 |
255 |
|