Convert -218 to binary and represent it in Sign-and-Size code
To convert 218(base 10) to binary:
218/2=109 → quotient=109 remainder=0
109/2=54+1 → quotient=54 remainder=1
54/2=27 → quotient=27 remainder=0
27/2=13+1 → quotient=13 remainder=1
13/2=6+1 → quotient=6 remainder=1
6/2=3 → quotient=3 remainder=0
3/2=1+1 → quotient=1 remainder=1
1/2=0+1 → quotient=0 remainder=1
So
"218_{10}=1\\cdot2^7+1\\cdot2^6+0\\cdot2^5+1\\cdot2^4+1\\cdot2^3+0\\cdot2^2+1\\cdot2^1+0\\cdot2^0=11011010_2"
There are three types of representations for signed binary numbers. These are: Sign-Magnitude form, 1’s complement form, and 2’s complement form.
Sign-Magnitude form: for negative n bit binary numbers, the most significant sign bit is 1
1’s complement form: the 1's complement form of a negative binary number is the bitwise NOT applied to it (the 'complement' of its positive counterpart)
2’s complement form: negative numbers are represented by the bit pattern which is one greater than the 1's complement
Answer: Sign 1 and Size 11011010 code
Comments
Leave a comment