128 = 1000 0000 reflect = 0111 1111 add one = 1000 0000 ??????
Range of N Bit 2's Complement |
---|
-(2(n-1)) ... 0 ... 2(n-1) - 1 |
eg n= 8 -(2(8-1)) = -128 ... 0 ... 2(8-1) - 1 = 127 |
This is not good.
A non-zero integer and its negative can't both be represented by the
same pattern.
So +128 can not be repd in eight bits.
The maximum positive integer that can be repd in
eight bits is 12710.
The negative integers
What number is represented by 1000 0000? Add the repn of 12710 to it:
1000 0000 = ? 0111 1111 = 12710 --------- 1111 1111 = -110
A good choice for ? is -12810. Therefore 1000 0000 represents -12810.
Eight bits can represent the numbers