Topic : Introduction To computers Faculty : Department of commerce and Management BY: Prof.Meeta R. Gujarathi E mail: meetargujarathi@gmail.com Octal Hexadecimal Number conversion TOPICS Other Number Systems Octal and hex are a convenient way to represent binary numbers, as used by computers. Computer mechanics often need to write out binary quantities, but in practice writing out a binary number such as Other Number Systems 000000000 is tedious, and prone to errors. Therefore, binary quantities are written in a base-8 ("octal") or, much more commonly, a base- ("hexadecimal" or "hex") number format.
Base = 8 or o or Oct 8 symbols: { 0,,,, 4,,, 7}, 7, 74 etc 987 This is incorrect why? How to represent a Decimal Number using a Octal Number System? Repeated Division by 8 0 = ( ) 8? Divide-by -8 Quotient Remainder Octal digit / 8 / 8 / 8 0 Answer = 8 Lower digit = Second digit = Third digit = How to convert 8 back to Decimal? Use this table and multiply the digits with the position values 8 7 4 8 7 8 8 8 4 8 8 8 8 0 78 409 4 8 How to convert 8 back to Decimal? Consider the above number (8) x 8 + x 8 + x 8 0 = x 4 + x 8 + x = 9 + + =
Convert 8 Consider the above number (8) x 8 + x 8 + x 8 0 = x 4 + x 8 + x = 84 + 8 + = 9 Convert 9 to octal Divide-by -8 Quotient Remainder Octal digit 9 / 8 49 / 8 / 8 49 0 Answer = 8 Lower digit = Second digit = Third digit = Hexadecimal Number Systems Base = or H or Hex symbols: { 0,,,, 4,,, 7,8,9 } { 0=A, =B, =C, =D, 4=E, = F} Hexadecimal Number Systems {0,,,,4,,,7,8,9,A,B,C,D,E,F} It uses Letters! AB, 87F, FFFF etc How to represent a Decimal Number using a Hexadecimal Number System?
Hex Number Systems Repeated Division by 0 = ( )? Divide-by - Quotient Remainder Hex digit / / 0 Lower digit = Second digit =D Hex Number Systems How to convert D back to Decimal? Use this table and multiply the digits with the position values 8 7 4 7 4 0.. 409 Answer = D Hex Number Systems How to convert D back to Decimal? Consider the above number D () D x + x 0 = x + x = 08 + = A single bit can represent two states:0 Therefore, if you take two bits, you can use them to represent four unique states: 00, 0, 0, & And, if you have three bits, then you can use them to represent eight unique states: 000, 00, 00, 0, 00, 0, 0, & 4
And, if you have three bits, then you can use them to represent eight unique states: These have a perfect correspondence to Octal 000 = Octal 0 00 = Octal 4 00 = Octal 0 = Octal 00 = Octal 0 = Octal 0 = Octal = Octal 7 With every bit you add, you double the number of states you can represent. Therefore, the expression for the number of states with n bits is n. Most computers operate on information in groups of 8 bits, A unit of four bits, or half an octet, is often called a nibble (or nybble). It can encode different values, such as the numbers 0 to. Any arbitrary sequence of bits could be used in principle,, but in practice the most common scheme is: 0000 = decimal 00 hex 0 000 = decimal 08 hex 8 000 = decimal 0 hex 00 = decimal 09 hex 9 000 = decimal 0 hex 00 = decimal 0 hex A 00 = decimal 0 hex 0 = decimal hex B 000 = decimal 04 hex 4 00 = decimal hex C 00 = decimal 0 hex 0 = decimal hex D 00 = decimal 0 hex 0 = decimal 4 hex E 0 = decimal 07 hex 7 = decimal hex F These have perfect correspondence to Hex
Convert Binary to Hex Group into 4's starting at least significant symbol (if the number of bits is not evenly divisible by 4, then add 0's at the most significant end) write hex digit for each group Convert Binary to Hex Example: Convert 00 0 0 0000 to Hex After grouping follow the procedure as discussed in the previous section use the symbols of Hex number system like =E 00 0 0 0000 9 E 7 0 Convert Binary to Hex Example: Convert 00 00 0 0000 to Hex 0 00 00 0000 This group has only two bits, to make it a group of 4 bits add zeros in MSB position 000 00 00 0000 0 Convert Hex to Binary For each of the Hex digit write its binary equivalent (use 4 bits to represent) Convert A0 to binary 000 00 00 0000
Convert Binary to Octal Group into 's starting at least significant symbol (if the number of bits is not evenly divisible by, then add 0's at the most significant end) write octal digit for each group Convert Binary to Octal Example: Convert 00 0 0 0000 to Oct After grouping follow the procedure as discussed in the previous section use the symbols of Oct number system like add two zeros here 00 00 00 0 000 7 0 Answer = 70 8 Convert Octal to Binary For each of the Octal digit write its binary equivalent Convert 70 to binary 00 0 000 7