Twos Complement Representation
Twos complement is another way to represent signed integers.To encode a negative number, get the binary representation of its magnitude, COMPLEMENT each bit, then ADD 1. (get Ones complement, then add 1).
What is -5 in Twos Complement, 8 bits?
The magnitude 5 in 8-bits is % 00000101 = $ 05
Now complement each bit: % 11111010 = $FANow add one: $FA + 1 = $FB$FB is the 8-bit, twos complement representation of -5.NOTE: positive numbers in 2s complement are simply their binary representation.