Negative numbers are usually represented without a binary complement.
To convert positive to negative, logic is used
x -> not(x)+1
For 8-bit arithmetic
01111111b - 127, and -127 - 10000000b + 1 = 10000001b
and in the opposite direction -127 10000001b will become
01111110b + 1 = 01111111b
How about -128?
-128 is equal to 10000000b, and there is no positive analogue of it, since there is no 128-bit arithmetic signed in 8 bits.
10000000 → 01111111 + 1 = 10000000 and -128 again
The same goes for the original question
Luka Rahne Jun 28 2018-12-12T00: 00Z
source share