Binary Conversion

advertisement
Binary Conversion
August 21 (Day); August 15 (Night)

Decimal Numbering:
o
Our traditional numbering system is known as decimal (dec means ten).
o
Because we use ten numbers (0-9), we also call this numbering system base 10.
o
Here is a breakdown of how we calculate the value of the decimal number 1563.
103=1000
102=100
101=10
100=1
1
5
6
3

Then we do the following:
(1 X 1000)
(5 X 100)
(6 X 10)
(3 X 1)
1000
500
60
3
1000 + 500 + 60 + 3 = 1563

Binary Numbering:
o
Computers, on the other hand, use a numbering system known as binary (bi
means two). More importantly to us, an understanding of binary is essential to a
solid understanding of network addressing.
o
Because we many only use two numbers (0 or 1), we call this numbering system
base 2.
o
Here is a breakdown of how we calculate the value of the binary number 10110.
24=16
23=8
22=4
21=2
20=1
1
0
1
1
0
o
Then we do the following.
(1 X 16)
(0 X 8)
16
0
16 + 0 + 4 + 2 + 0=22
(1 X 4)
(1 X 2)
(0 X 1)
4
2
0

Converting a Byte (Binary to Decimal Conversion):
o
Remember that computers process data in binary digits known as bits. The
computer processes bits in groups of eight known as bytes.
o
Because 28=256, a byte can represent 256 different values.
o
Let’s look at how we could convert a byte in binary form into decimal form.
Let’s convert the binary number 10111011.
27=128
26=64
25=32
24=16
23=8
22=4
21=2
20=1
1
0
1
1
1
0
1
1
o
Then we do the following:
(1 X 128)
(0 X 64)
(1 X 32)
(1 X 16)
(1 X 8)
(0 X 4)
(1 X 2)
(1 X 1)
128
0
32
16
8
0
2
1
128 + 32 + 16 + 8 + 2 + 1 = 187

Decimal to Binary Conversion:
o Here’s how we would convert the decimal number 187 to a binary number.
o
First, we divide the number 187 by 128. It goes into 187 one time and leaves a
remainder of 59.
o
Secondly, we divide the remainder of the previous step (which is 59) by 64. It
goes into 64 zero times with a remainder of 59.
o
We continue these steps like so.
187
59
59
27
11
3
3
1
/ 128
/ 64
/ 32
/ 16
/
8
/
4
/
2
/
1
=
=
=
=
=
=
=
=
1
0
1
1
1
0
1
1
rem
rem
rem
rem
rem
rem
rem
rem
59
59
27
11
3
3
1
0
This leaves us with a binary number of 10111011.
o
Let’s practice another one.
113 / 128 =
113 / 64 =
49 / 32 =
17 / 16 =
1 /
8 =
1 /
4 =
1 /
2 =
1 /
1 =
Convert the decimal number 113 to a binary number.
0 rem 113
1 rem 49
1 rem 17
1 rem 1
0 rem 8
0 rem 4
0 rem 1
1 rem 0
This leaves us with a binary number of 01110001.
Download