DLD Number System and Conversion
DLD Number System and Conversion
Prepared by:
Areej Fatima
2
Preamble (Past Lesson Brief)
Octal to Binary
Octal to Decimal
Octal to Hexadecimal
Hexadecimal to Binary
Hexadecimal to Decimal
Hexadecimal to Octal
Technique
Convert each octal digit to a 3-bit equivalent binary representation
Octal to Binary Conversion
6 5 3
7058 = ?2 7 0 5
7058 = 1110001012
Octal to Decimal
Technique
n
Multiply each bit by 8 , where n is the “weight” of the bit
The weight is the position of the bit, starting from 0 on the right
Add the results
Octal to Decimal Conversion
42710
Example
7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810
Octal to Hexadecimal
Technique
Use binary as an intermediary
Example 1F0C16 = ?8
1 F 0 C
1 7 4 1 4
1F0C16 = 174148
Hexadecimal Binary
Example:
Example:convert 1001100011100110122
convert10011000111001101 hexadecimal
hexadecimal
Group
Groupbyby4s,
4s,starting
startingatatthe right
theright expand
expandintointo44bit
bitgroups
groups
110011
00110001
00011100 110122
11001101 113311CCDD1616
Hex
Hex Binary
Binary Decimal
Decimal
00 0000
0000 00
Memorize 11 0001
0001 11
this table!!! 22 0010
0010 22
It makes 33 0011
0011 33
44 0100
0100 44
conversions 55 0101 55
0101
between 66 0110
0110 66
hexadecimal 77 0111
0111 77
and binary 88 1000
1000 88
99 1001
1001 99
trivial AA 1010 10
1010 10
BB 1011
1011 11
11
CC 1100
1100 12
12
DD 1101
1101 13
13
EE 1110
1110 14
14
FF 1111
1111 15
15
Hexadecimal to Decimal
Technique
n
Multiply each bit by 16 , where n is the “weight” of the bit
The weight is the position of the bit, starting from 0 on the right
Add the results
Hexadecimal to Decimal Conversion
15,18310
Example
1 7 4 1 4
1F0C16 = 174148
17
References
Q &A