Numbering Systems - WO-TEJ4

advertisement
Numbering Systems
Ours is not to reason why
Ours is to
Invert and Multiply…
Numbering Systems
Since early times mankind has used many
different types of symbols to represent numbers
In North America we use the Base 10 system.
There are several different types of number
systems. Each is used for different purposes
and each is different, yet similar.



Binary (used in computers) Base 2
Hexadecimal(used in computers) Base 16
Decimal (used in North America) Base 10
Decimal (Base 10)
It consists of 10 digits (hence the name decimal).
The digits, from smallest to largest are:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
Now, any number can be broken down into columns.
From right to left, the first column is the 1's column, then
the 10's column, then the 100's, then the 1000's, etc..
Thousands
0
Hundreds
1
0 X 1000 = 0 (0 thousands)
1 X 100 = 100 (1 hundreds)
3 X 10 = 30 (3 tens)
7 X 1 = 7 (7 ones)
0+100 + 30 + 7 = 137
Tens
3
Ones
7
An Example
lets try the number 77:
Thousands
Hundreds
Tens
Ones
0
0
7
7
0 X 1000 = 0 (0 thousands)
0 X 100 = 0 (0 hundreds)
7 X 10 = 70 (7 tens)
7 X 1 = 7 (7 ones)
0+0+70 + 7 = 77
Binary (Base 2)
Your computer works using the binary
numbering system.
The binary numbering system is ideal for
representing these two states because it
consists of only two digits.
Once again, any number can be broken down
into columns.
Using the binary numbering system, from right
to left, the first column is the 1's column,the 2's
column, the 4's, the 8's, the 16's column, the
32's column, etc..
Let's look at the number 137 again
128
1
64
0
32
0
16
0
8
1
4
0
2
0
1
1
1 X 128 = 128 (1 one hundred twenty-eights)
0 X 64 = 0 (0 sixty-fours)
0 X 32 = 0 (0 thirty-twos)
0 X 16 =0 (0 sixteen's)
1 X 8 = 8 (1 eights)
0 X 4 = 0 (0 fours)
0 X 2 = 0 (0 twos)
1 X 1 = 1 (1 ones)
Converting Decimal to Binary
There are a number of ways to convert between
decimal and binary.
Lets start with converting the decimal value 254 to
binary.
Method 1: Use the binary calculator. What we have
been doing before. 20 21 22 23 24 25
Method 2: Divide the number by 2. Then divide
what's left by 2, and so on until there is nothing left
(0).
Write down the remainder (which is either 0 or 1) at
each division stage.
Once there are no more divisions, list the remainder
values in reverse order. This is the binary equivalent.
254 / 2 giving 127 with a remainder of 0
127 / 2 giving 63 with a remainder of 1
63 / 2 giving 31 with a remainder of 1
31 / 2 giving 15 with a remainder of 1
15 / 2 giving 7 with a remainder of 1
7 / 2 giving 3 with a remainder of 1
3 / 2 giving 1 with a remainder of 1
1 / 2 giving 0 with a remainder of 1
Reading in reverse order(Bottom to top)
1111110 Tada.. Not too shabby!
Another example, 132 decimal
132 / 2 giving 66 with a remainder of 0
66 / 2 giving 33 with a remainder of 0
33 / 2 giving 16 with a remainder of 1
16 / 2 giving 8 with a remainder of 0
8 / 2 giving 4 with a remainder of 0
4 / 2 giving 2 with a remainder of 0
2 / 2 giving 1 with a remainder of 0
1 / 2 giving 0 with a remainder of 1
Thus the binary equivalent is 10000100
128 + 0 + 0 + 0 + 8 + 0 + 0 + 1 = 137
Thus, the binary number 10001001 is equal to 137
decimal.
A single digit (0 or 1) is called a 'bit' (binary digit).
The table above contains 8 bits. Each column can
contain either a 1 or a 0 ( 'cause there is only 2 digits in
the binary numbering system).
So, as you can see, it takes 8 bits to represent the
decimal number 137.
lets try the number 77:
128
64
32
16
8
4
2
1
0 X 128 = 0 (0 one hundred twenty-eights)
1 X 64 = 64 (1 sixty-fours)
0 X 32 = 0 (0 thirty-twos)
0 X 16 =0 (0 sixteen's)
1 X 8 = 8 (1 eights)
1 X 4 = 4 (1 fours)
0 X 2 = 0 (0 twos)
1 X 1 = 1 (1 ones)
0 + 64 + 0 + 0 + 8 + 4 + 0 + 1 = 77
Thus, the binary number 01001101 is equal to
77 decimal
Solve the first two rows using a binary
calculator Then solve the last 2 rows
using division.
254
8
127
13
255
1020
397
9999
20
5
16
99
178
33
207
3578
Hexadecimal Number System
[Base-16]
The hexadecimal number system uses
SIXTEEN values to represent numbers.
The values are 0 1 2 3 4 5 6 7 8 9 A B C D E
F
With 0 having the least value and F having
the greatest value.
Hexadecimal is often used to represent
values [numbers and memory addresses]
in computer systems.
Converting hexadecimal to decimal
Convert 176 in hexadecimal to decimal
Each column represents a power of 16,
176 =
---- 6 * 160 = 6
----- 7 * 161 = 112
------ 1 * 162 = 256
-----= 374
Convert 11 in hexadecimal to base 10
11 =
1 * 160
=
1 * 161
= 16 + 1 = 17
Practice Hex to Decimal
3DA
D9E
F3A1
09
6612
55
44A9
645
14DE
F309
B8A4
3D
Converting binary to hexadecimal
Convert 10110 to hexadecimal.
Each hexadecimal digit represents 4 binary
bits.
Split the binary number
into groups of
4 bits, starting from the right.
1
0110
=1
=6
= 16 in hexadecimal.
Try 1111110 base 2 to base 16
What did you get ??
Practice Bin to Hex
1010101
1000100
0010010
0101101
11110111
101010101
11111110
1110001
11011100
1011100
1000
1110
Converting decimal to hexadecimal
Convert 232 decimal to hexadecimal.
Use the same method used earlier to divide
decimal to binary, but divide by 16 this time.
232 / 16 = 14 with a remainder of 8
8 / 16 = you can’t have since 8 is smaller
than 16. So the 8 becomes the last digit.
So you get 14 and a 8. Remember…
(14 decimal = E) = E816
A=10, B=11, C=12, D=13, E=14, F=15
Practice Decimal to Hex
15
15831
902
55
6612
5589
13
91145
3
14
309
84
96
11
1449
64000
Notation
To avoid confusion, we often add a suffix to
indicate the number of the base.
162h
h means hexadecimal
16216
16 means base 16
162d
d means decimal
16210
10 means base 10
162o
o means octal
1628
8 means base 8
101b
b means binary
1012
2 means base 2
More Converting
For Review, Work on the handout called
“Digital 1”
Specific problems or questions come
and ask me.
Copy and complete the following charts
in your books.
Binary
101010102
001100112
111111112
101110102
111100102
001000112
000100012
100000002
100101012
111111112
Hex
Decimal
Hex
345
AF56
78C1
B0D5
7156
9
185
FFFF
FFF
FF
Binary
Decimal
Decimal
345
32768
255
1289
15
1000
1024
999
1678
2000
Hex
Binary
Download