Search code examples
binarysignedcomplement

Signed magnitude, 1's complement and 2's complement of +46 and -17


can anyone verify if am I correct?

+46 (7 bits)
S.M : 0101110
1's C. : 0101110 ( the same )
2's C. : 0101110 ( the same )

-17 (7 bits)
S.M : 1010001
1's C. : 1101110
2's C. : 1101111

Solution

  • The +46 ones are all incorrect (your comment is correct). To test the signed magnitude, just break down the magnitude component like:

    0 * 1 + 
    1 * 2 +
    1 * 4 +
    0 * 8 +
    1 * 16 + 
    1 * 32
    

    Once you get the signed magnitude, the others should be easy.

    Your -17 are all correct.