Transcription of Conversion of Binary, Octal and Hexadecimal …
1 Conversion of binary , Octal andHexadecimal NumbersFrom binary to OctalStarting at the binary point and working left, separate the bits intogroups of three and replace each group with the corresponding = 010 001 011 = 2138 From binary to HexadecimalStarting at the binary point and working left, separate the bits intogroups of four and replace each group with the correspondinghexadecimal = 1000 1011 = 8B16 From Octal to BinaryReplace each Octal digit with the corresponding 3-bit binary = 010 001 011 = 100010112 From Hexadecimal to BinaryReplace each Hexadecimal digit with the corresponding 4-bit = 1000 1011 = 100010112 Conversion of Decimal NumbersFrom Decimal to Binary171234026912139128024022021 MSDLSDFrom binary to Decimal100010112= 1 27 + 0 26 + 0 25 + 0 24 + 1 23 + 0 22 + 1 21 + 1 20= 128 + 8 + 2 + 113910 = 100010112 Conversion of FractionsStarting at the binary point.
2 Group the binary digits that lie tothe right into groups of three or = 110 = = 1000 = the followingBinaryOctalDecimalHex1001101027 0527053 BCBinaryOctalDecimalHex100110102321549A1 0111000101270514775C51010100100015221270 5A91111011110016749563BC5422833828270518 10=A1699162705116 Add111110011+ 1 0 0 1+ 1 1 1 011000100001 Subtract1100010011- 1 1 1 1- 1 1 1 11001100 Multiplynormallyfor implementation - add the shiftedmultiplicands one at a 141110* 1 1 0 1= 13* 1 1 0 1111011100000+ 0 0 0 0 111001110+ 1 1 1 0 + 1 1 1 0 101101101000110+ 1 1 1 0 10110110(8 bits)Divide 1 1 0 1 1 1 0 1111)11000101|1101)1011001|1 1 1 1 |1 1 0 1 |1001101|100101|1 1 1 1 |1 1 0 1 |10001|1011|0 0 0 0 |0 0 0 0 |10001|10111 1 1 1 |10 1 0 0 1 1101)1111001|1 1 0 1 |10001|0 0 0 0 |10001|0 0 0 0 |10001|1 1 0 1 |100 Sign-Magnitude0 = positive1 = negativen bit range = -(2n-1-1) to +(2n-1-1)4 bits range = -7 to +72 possible representation of 's Complementflip bits and add bit range = -(2n-1) to +(2n-1-1)
3 4 bits range = -8 to +70 0 0 0= 00 0 0 1= 10 0 1 0= 20 0 1 10 1 0 00 1 0 10 1 1 00 1 1 1= 71 0 0 0= -81 0 0 1= -71 0 1 01 0 1 11 1 0 01 1 0 11 1 1 0= -21 1 1 1= -1 Example1 1 1 0= 140 0 0 1flip bits0 0 1 0add one WRONG this is not -14. Out of range. Need 5 bits0 1 1 1 0= 141 0 0 0 1flip bits1 0 0 1 0add one. This is Extendadd 0 for positive numbersadd 1 for negative numbersAdd 2's Complement1110= -21110=-2 + 1 1 0 1= -3+ 0 0 1 1= 311011ignore carry = -510001ignore carry = 1Be careful of overflow errors. An addition overflow occurs whenever the sign of the sum ifdifferent from the signs of both operands. 41100=-4 + 0 1 0 1= 5+ 1 0 1 1= -51001= -7 WRONG10111ignore carry = 7 WRONGM ultiply 2's Complement1110= -21110=-2 * 1 1 0 1= -3* 0 0 1 1= 311111110sign extend to 8 bits11111110sign extend to 8 bits+ 0 0 0 0 0 0 0+ 1 1 1 1 1 1 011111110111111010ignore carry = -6+ 1 1 1 1 1 0111110110ignore carry+ 0 0 0 1 0negate -2 for sign bit100000110ignore carry = 610010= -14 * 1 0 0 1 1= -131111110010sign extend to 10 bits+ 1 1 1 1 1 0 0 1 011111010110ignore carry+ 0 0 0 0 0 0 0 01111010110+ 0 0 0 0 0 0 01111010110+ 0 0 1 1 1 0negate -14 for sign bit10010110110ignore carry = 182 Floating-Point Numbersmantissa x (radix)
4 ExponentThe floating-point representation always gives us more range and less precision than thefixed-point representation when using the SAME number of excess1023 charactsticMantissasign52-bit normalized fractionSignexponentMantissasignMantissa magnitude8-bit excess-127characteristicMantissasign23-b it normalized fractionGeneral format32-bit standard64-bit standard01126331910 Implied binary pointNormalized fraction - the fraction always starts with a nonzero bit.. x 2e would be normalized to .. x .. x 2e would be normalized to .. x 2e+1 Since the only nonzero bit is 1, it is usually omitted in all computers today. Thus, the 23-bitnormalized fraction in reality has 24 exponent is represented in a biased form.
5 If we take an m-bit exponent, there are 2m possible unsigned integer values. Re-label these numbers: 0 to 2m-1 -2m-1 to 2m-1-1 by subtracting a constant value (orbias) of 2m-1 (or sometimes 2m-1-1). Ex. using m=3, the bias = 23-1 = 4. Thus the series 0,1,2,3,4,5,6,7 becomes -4,-3,-2,-1,0,1,2,3. Therefore, the true exponent -4 is represented by 0 in the bias form and -3 by+1, etc. zero is represented by .. x if n = , we normalize it to x 24. The true exponent is +4. Using the32-bit standard and a bias of 2m-1-1 = 28-1-1 = 127, the true exponent (+4) is stored as a biasedexponent of 4+127 = 131, or 10000011 in binary .
6 Thus we have0 | 1 0 0 0 0 0 1 1 | 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Notice that the first 1 in the normalized fraction is biased exponent representation is also called excess n, where n is 2m-1-1 (or 2m-1).
