3.0 Introduction To Number Systems
3.0 Introduction To Number Systems
NUMBER SYSTEMS
CCICOMP
OUTLINE
• NUMBER SYSTEMS
• BASE CONVERSIONS
RECALL:
• Computers process data into information
• Computers work exclusively with numbers. All data is represented
in binary form
• Binary represents data in combinations of 1’s and 0’s
• But, what exactly is ‘binary’??
5217.2510
consisting of r elements (also known as
radix or base).
• The largest-valued symbol always has a
magnitude of one less than the radix.
• Each variable that denotes a digit is
assigned a weight dependent on its
position relative to a radix point.
5217.25
5 x 10-2 = 5 / 10 / 10
2 x 10-1 = 2 / 10
• Radix/Base: 10 7 x 100 = 7
• Symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 1 x 101 = 1 x 10
10112
1 x 20 = 1
1 x 21 = 1 x 2
0 x 22 = 0 x 2 x 2
1 x 23 = 1 x 2 x 2 x 2
OCTAL NUMBER SYSTEM
• Radix/Base: 8
• Symbols: 0, 1, 2, 3, 4, 5, 6, 7
• Written as: 327o or 3278
• Each digit is weighted by powers of 8
3278
7 x 80 = 7
2 x 81 = 2 x 8
3 x 82 = 3 x 8 x 8
HEXADECIMAL
NUMBER SYSTEM
• Radix/Base: 16
• Symbols: 0, 1, 2, 3, 4, 5, 6,
7, 8, 9, A (10), B (11), C
(12), D (13), E (14), F (15) 5C816
• Written as: 5C8h or 5C816
• Each digit is weighted by 8 x 160 = 16
powers of 16 12 x 161 = 12 x 16
5 x 162 = 5 x 16 x 16
BASE CONVERSION
• BINARY DECIMAL
• BINARY OCTAL
• BINARY HEXADECIMAL
• DECIMAL OCTAL
• DECIMAL HEXADECIMAL
BINARY → DECIMAL CONVERSION
• Each digit appearing to the left of the binary point represents a value of
either zero or one times an increasing power of two.
EXAMPLE 1:
1012 = ?10 1 0 1
1x22 0x21 1x20
= 1x22 + 0x21 + 1x20
= 4 + 0 + 1
= 510
BINARY → DECIMAL CONVERSION
• Each digit appearing to the left of the binary point represents a value of
either zero or one times an increasing power of two.
EXAMPLE 2:
1010102 = ?10 1 0 1 0 1 0
1x25 0x24 1x23 0x22 1x21 0x20
EXAMPLE 1:
578 = ?2 5 7
1 0 1 1 1 1 = 1011112
EXAMPLE 2:
3268 = ?2 3 2 6
0 1 1 0 1 0 1 1 0 = 110101102
BINARY → HEXADECIMAL CONVERSION
• One hexadecimal digit is equivalent to four binary digits.
• Group the bits by four starting from the least significant bit.
• If the grouping does not have enough to form 4 bits then append 0 to the
most significant bit.
EXAMPLE 1:
11012 = ?16
1 1 0 1
1x23 +1x22 + 0x21 + 1x20
=1x23 +1x22 + 0x21 + 1x20
=8 +4 +0 +1
=D16 *RECALL: 1310 = D16
BINARY → HEXADECIMAL CONVERSION
• One hexadecimal digit is equivalent to four binary digits.
• Group the bits by four starting from the least significant bit (rightmost).
• If the grouping does not have enough to form 4 bits then append 0 to the
most significant bit.
EXAMPLE 2: 0 1 1 0 1 0 1 0
11010102 = ?16
0x23 +1x22 + 1x21+0x20 1x23 +0x22 + 1x21 + 0x20
= 0x23 +1x22 + 1x21+0x20 | 1x23 +0x22 + 1x21 + 0x20
=0 +4 + 2 +0 |8 +0 +2 +0
=6A16
HEXADECIMAL → BINARY CONVERSION
• Since one hexadecimal digit is equivalent to four binary digits, just convert
the individual hexadecimal digit into four binary digits
• Pad with 0s if the binary equivalent of a hex digit is less than 4 digits.
EXAMPLE 1:
B A E
BAE16 = ?2
1 0 1 1 1 0 1 0 1 1 1 0
= 1011101011102
EXAMPLE 2:
9 1 D
91D16 = ?2
1 0 0 1 0 0 0 1 1 1 0 1
= 1001000111012
DECIMAL → OCTAL CONVERSION
• Converting a decimal number to an octal number is done by successively
dividing the decimal number by 8
• Answer consists of the remainders read bottom up
R R
EXAMPLE 1: EXAMPLE 2:
8 66 2 8 150 6
6610 = ?8 15010 = ?8
8 8 0 8 18 2
8 1 1 8 2 2
0 0
= 1028 = 2268
OCTAL → DECIMAL CONVERSION
• Each digit appearing to the left of the radix point represents a value between
zero to seven (inclusive) times an increasing power of eight.
EXAMPLE 1: EXAMPLE 2:
278 = ?10 2 7 278 = ?10 1 7 5
2x81 7x80 1x82 7x81 5x80
R R
EXAMPLE 1: EXAMPLE 2:
16 286 14 (E) 16 351 15 (F)
28610 = ?16 35110 = ?16
16 17 1 16 21 5
16 1 1 16 1 1
0 0
= 11E16 = 15F16
HEXADECIMAL → DECIMAL CONVERSION
• Each digit appearing to the left of the radix point represents a value between
zero to 15 (inclusive) times an increasing power of 16.
EXAMPLE 1: EXAMPLE 2:
2A16 = ?10 2 A 30516 = ?10 3 0 5
2x161 10x160 3x162 0x161 5x160