One’s Complement
(integer representation)
Nines
complement of a base 10 number is worked out by subtracting it from 999 999 or
any other number made up of 9s
For
example
|
|
9 |
9 |
9 |
9 |
9 |
9 |
- |
|
|
|
|
|
1 |
3 |
5 |
|
|
|
9 |
9 |
9 |
8 |
6 |
4 |
|
So the
9s complement of 135 is 999 864. This can also be called –135.
Ones
complement of a base 2 number is worked out by subtracting it from 1111 1111 or
any other number made up of ones.
|
|
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
- |
|
|
1 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
|
|
|
0 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
|
The
easiest way of working out ones complement of a base 2 number is to replace the
1s with 0s and the 0s with 1s.
For
example
1s
complement of 111 is 000
and
1s
complement of 1001 1100 is 0110 0011