0
$\begingroup$

So if I have the number 17 ( 8 bit code), the signed-magnitude representation is : 00010001
For -17 : 10010001
For 1's complement 17 = 00010001
For 1's complement -17 = 11101110
For 2's complement 17 = 00010001
For 2's complement -17 = 11101111
Please I need someone to tell me if it is correct.
Thank you in advance.

$\endgroup$
0
2
$\begingroup$

Yup.

You can test your 2's compliment math on a calculator that displays binary. For $n$-bit numbers, you negate the number by subtracting it from (positive) $2^n$.

So -17, in 2's compliment, is 100000000 - 00010001 = 11101111. Or subtract 17 from 256, and then display the result in binary.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.