What is the 8-bit two's complement representation of −5? Give the answer as a decimal value of the binary pattern.
What is the 8-bit two's complement representation of −5? Give the answer as a decimal value of the binary pattern.
Answer
251
Theory
Two's complement of −x in n bits = 2ⁿ − x (interpreted as unsigned).
Solution
2⁸ − 5 = 256 − 5 = 251 (binary 11111011).