0
votes

In an 8-bit memory location, the integer +128 is 10000000 but also using two's complement method -128 integer is represented as 10000000.

I find this weird. Why is +128 or 128(unsigned) represented as 10000000? The leftmost bit is 1, and this means that it is negative where in fact it is positive...

1
i dont understand your question. you mix two things up: two's complement and unsigned numbers. they are two different thingsRaildex

1 Answers

2
votes

810 bits can represent 210810 = 25610 different values. The range from -12810 to +12810 contains 25710 different values.

It is impossible to represent the full range of integers from -12810 to +12810 in 810 bit. You will have to remove at least one integer from that range.

In other words: +12810cannot be represented in 810 bit two's complement binary representation.

In an 8-bit memory location, the integer +128 is 10000000

That is correct. However, when you use all 8 bits to represent positive numbers, then you simply cannot represent negative numbers at all.

but also using two's complement method -128 integer is represented as 10000000.

That is also correct.

I find this weird. Why is +128 or 128(unsigned) represented as 10000000?

They are two different representations.

The leftmost bit is 1, and this means that it is negative where in fact it is positive...

It only means that it is a negative number in two's complement representation. But it is not two's complement representation. It is simple binary representation.