|
Week 5: DATA REPRESENTATION
NUMBER CONVERSIONS
In chapter 4, you will learn how to convert between the decimal, binary,
octal and hexadecimal numbering systems. The decimal numbering system is
the numbering system we use in our daily lives. The binary numbering system
is the method used to represent data in the computer system. The binary
numbering system is made up of a serial of 1s and 0s.
Since it is difficult to read a series of binary numbers to view the
contents of a memory location or a register, two shorthand versions of
the binary numbering systems were developed to make viewing binary numbers
easier. The hexadecimal and octal numbering systems were designed for that
purpose.
First you will look at the characteristics of all numbering systems
and then you will learn how to convert from one numbering system to another.
Topics:
List
the characteristics of numbering systems
List
the characteristics of each numbering system:
Decimal
Numbering System - Base 10
Binary
Numbering System - Base 2
Hexadecimal
Numbering System - Base 16
Octal
Numbering System - Base 8
Convert
each number type to the other three numbering systems:
Decimal
to Binary
Binary
to Decimal
Binary
to Octal
Octal
to Binary
Binary
to Hexadecimal
Hexadecimal
to Binary
Week
5 Course Guide | Home

Characteristics of
Numbering Systems
-
The smallest symbol is 0.
-
The largest symbol is the base minus 1.
-
The total number of symbols equals the base.
CHARACTERISTICS OF THE
DECIMAL NUMBERING SYSTEM BASE 10
-
Smallest symbol 0
-
Largest symbol 9
-
Total number of symbols 10
List of symbols - (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
CHARACTERISTICS OF
THE BINARY NUMBERING SYSTEM BASE 2
-
Smallest symbol 0
-
Largest symbol 1
-
Total number of symbols 2
List of symbols - (0, 1)
CHARACTERISTICS OF
THE HEXADECIMAL NUMBERING SYSTEM BASE 16
-
Smallest symbol 0
-
Largest symbol 15 (F) Because 15 is actually 2 digits, 1 and 5, the 15
is changed to the letter F.
-
Total number of symbols 15
List of symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F)
A = 10
B = 11
C = 12
D = 13
E = 14
F = 15
CHARACTERISTICS OF THE
OCTAL NUMBERING SYSTEM BASE 8
-
Smallest symbol 0
-
Largest symbol 7
-
Total number of symbols 8
List of symbols (0, 1, 2, 3, 4, 5, 6, 7)
Converting from the Decimal
to the Binary Numbering System:
You will convert numbers to 8 bit binary numbers. The process to
convert larger numbers is exactly the same.
You need to first write out the positional values of the binary numbering
system. But before you do, lets first take a look at the positional values
in the decimal numbering system.
We know the number 89210 (The 10 subscript indicates the
number is a decimal number) has the value eight hundred ninety two because
of the position of each digit in the number. The rightmost position is
the 1s position, the next position is the 10s position, and the leftmost
position is the 100s position. The 1s position is actually 100
anything to the 0 power is always 1. The 10s position is actually 101
-
which is 10. The 100s position is actually 102. If there was
a number before the 8, it would be in the 1000s position or 103.
The same principles are true for the other numbering systems. If
you look at a binary number 1012 (The 2 subscript indicates
the number is a binary number). The rightmost position is the 1s position,
the next position is the 2s position and the leftmost position is the
4s position. The 1s position is actually 20 anything to
the 0 power is always 1. The 2s position is actually 21 - which
is 2. The 4s position is actually 22 . If there
was a number before the leftmost 1, it would be in the 8s position or
23.
Lets start converting:
Write out the positional values of the binary numbering system for
8 positions.
27 26 25 24 23
22 21 20 which is actually
128 64 32 16 8 4 2 1 (you should be able to see a pattern start with
1 and double the numbers for 8 positions.)
-
Find the largest number that will divide into the decimal number from the
numbers listed (128, 64, 32, 16, 8, 4, 2, 1)
-
Place a 1 in that position.
-
Subtract the number from the decimal number.
-
Continue with steps 2 4 until you have a remainder of 0.
-
Place a 0 in all empty locations.
-
The result will give you the binary equivalent of the decimal number.
Lets look at an example:
Convert 5910 to binary:
-
Write out the positional values for the binary numbering system.
-
The largest number that will divide into the decimal number 59 is
32.
-
Place a 1 in that position.
-
Subtract 32 from 59. (59 32 = 27)
-
The largest number that will divide into the decimal number 27 is
16.
-
Place a 1 in that position.
-
Subtract 16 from 27. (27 16 = 11)
-
The largest number that will divide into the decimal number 11 is
8.
-
Place a 1 in that position.
|
|
1
|
1
|
1
|
|
|
|
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
-
Subtract 8 from 11. (11 8 = 3)
-
The largest number that will divide into the decimal number 3 is
2.
-
Place a 1 in that position.
|
|
1
|
1
|
1
|
|
1
|
|
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
-
Subtract 2 from 3. (3 - 2 = 1)
-
The largest number that will divide into the decimal number 1 is
1.
-
Place a 1 in that position.
|
|
1
|
1
|
1
|
|
1
|
1
|
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
-
Subtract 1 from 1.
-
You now have a result of 0. Place a 0 in the remaining positions.
0
|
0
|
1
|
1
|
1
|
0
|
1
|
1
|
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
-
The binary equivalent of 5910 is 001110112
Converting from the Binary to the Decimal Numbering
System:
To convert to a decimal number:
-
Place the positional values (128, 64, 32, 16, 8, 4, 2, 1) under
the binary number.
-
In every location where there is a 1 bit, add the numbers together.
-
The result will be the decimal equivalent.
Lets look at an example:
Convert this number 101010112 to a decimal number.
-
Place the positional values under the binary number.
1
|
0
|
1
|
0
|
1
|
0
|
1
|
1
|
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
-
In every location where there is a 1 bit, add the numbers together.
(128 + 32 + 8 + 2 + 1) = 17110
-
Decimal equivalent of 101010112 is 17110.
Converting from the Binary to the Octal Numbering
System:
The Octal Numbering System breaks a binary number into groups
of three and represents each group of three binary numbers with one octal
number. The reason the binary number is broken up into groups of three
is because the largest octal number that can be represented is 7 (the base
8 minus 1). It only takes 3 binary digits to represent the largest octal
number 7.
1 1 1 = (4 + 2 + 1) = 7
4 2 1
To convert to an Octal number:
-
Break the binary number into groups of three binary digits, starting with
the rightmost bit.
-
Convert each group of three binary digits into the octal equivalent separately.
Lets look at an example:
010101002
-
Break the number into groups of three binary digits, starting with the
rightmost bit.
01010100
=
Group1 = 100
Group 2 = 010
Group 3 = 01 (you
can add an extra 0 to the leftmost side, it will not change the value of
the number.)
-
Convert each group of three digits separately. Place the binary positional
values below each bit. Every place there is a 1 bit, add the numbers together.
Group 1 = 1 0 0 = 4
4 2 1
Group 2 = 0 1 0 = 2
4 2 1
Group 3 = 0 1 = 1
4 2 1
-
The octal equivalent of 010101002 is 4218
Converting from the Octal to the Binary Numbering
System:
To convert from a binary number to an octal number, you need
to list the three digit binary equivalent for each octal number.
-
List the binary number base for 3 places.
22 21 20 or 4 2 1
-
You want to add the numbers 4 or 2 or 1 to add up to the octal number.
For example: 6 is 4 + 2. You need to place a 1 in the 4 and 2 positions
and a 0 in the 1 position.
1 1 0
4 2 1
For example: 5 is 4 + 1. You need to place a 1 in the 4 and 1 positions
and a 0 in the 2 position.
1 0 1
4 2 1
-
Convert each octal number into a group of three binary digits.
For example:
4528
4 = 1 0 0 5 = 1 0 1 2 = 0 1 0
4 2 1 4 2 1 4 2 1
-
The binary equivalent of 4528 is 1001010102
Converting from the Binary to the Hexadecimal Numbering
System:
The Hexadecimal Numbering System breaks a binary number into
groups of four and represents each group of four binary numbers with one
hexadecimal number. The reason the binary number is broken up into groups
of four is because the largest hexadecimal number that can be represented
is 15 (the base 16 minus 1). It only takes 4 binary digits to represent
the largest hexadecimal number 15.
1 1 1 1 = (8 + 4 + 2 + 1) = 15
8 4 2 1
To convert to a Hexadecimal number:
-
Break the binary number into groups of four binary digits, starting with
the rightmost bit.
-
Convert each group of four binary digits into the hexadecimal equivalent
separately.
Lets look at an example:
010101002
-
Break the number into groups of four binary digits, starting with the rightmost
bit.
01010100 =
Group1 = 0100
Group 2 = 0101
Convert each group of three digits separately. Place the binary positional
values below each bit. Every place there is a 1 bit, add the numbers together.
Group 1 = 0 1 0 0 = 4
8 4 2 1
Group 2 = 0 1 0 1 = ( 4 + 1 ) = 5
8 4 2 1
-
The hexadecimal equivalent of 010101002 is 4516
Converting from the Hexadecimal
to the Binary Numbering System:
To convert from a hexadecimal number to a binary number, you
need to list the four digit binary equivalent for each hexadecimal number.
List the binary number base for 4 places.
23 22 21 20 or 8 4 2 1
-
You want to add the numbers 8 or 4 or 2 or 1 to add up to the hexadecimal
number.
For example: A is 8 + 2. You need to place a 1 in the 8 and 2 positions
and a 0 in the 1 and 4 positions.
1 0 1 0
8 4 2 1
For example: 9 is 8 + 1. You need to place a 1 in the 8 and 1 positions
and a 0 in the 2 and 4 positions.
1 0 0 1
8 4 2 1
-
Convert each hexadecimal number into a group of four binary digits.
For example:
B316
B = 1 0 1 1 3 = 0 0 1 1
8 4 2 1 8 4 2 1
-
The binary equivalent of B316 is 101100112
Week
5 Course Guide | Home
|