so is representation of -128 10000000 or 110000000 ? Is the representaion bit dependent ?
Yes, 2's complement representation is bit dependent
Why not simply make the lower range -127 fot 8 bits instead of writing -128 as 10000000
2^8 = 256. So whatever representation scheme you use, it should be able to represent 256 different values.
And you can draw a circle to understand how good 2's complement system is.
First look at this table :
Bits Unsigned 2's complement
00000000 0 0
00000001 1 1
00000010 2 2
01111110 126 126
01111111 127 127
10000000 128 −128
10000001 129 −127
10000010 130 −126
11111110 254 −2
11111111 255 −1
for 2's complement system you can draw circle for understanding this system.
Here is the 4 bit version. You can easily develop a 8bit version on yourself. This circle represent what this 2's complement system actually is. Its a circular system. That means its representation depends on the "span" you give it to it. thats why 8bit version of a negative number will differ with a 16 bit version of same negative number. you can compare same negative number in 4bit version given in the circle with 8bit version given in the table.
0000 0
1111 -1 0001 1
1110 -2 0010 2
1101 -3 0011 3
1100 -4 0100 4
1011 -5 0101 5
1010 -6 0110 6
1001 -7 0111 7
1000 -8
On a side note, 2's complement arithmetic plays good with "fixed" width computation storages inside computers(registers, memory etc).
In first generation computers, there was a tendency to provide native decimal arithmetic. But this was quickly abandoned in favour of "complemented" or "circular" scheme because, decimal arithmetic is bizarre from a computer's point of view. We find it natural because "we have 10 fingers". These fingers were our ancestor's earliest computation tool. thats why we find decimal system so natural. its built into our genes.