The Decimal System
·
Comprises 10
digits: 0-9, which are recognized as the symbols in the system.
·
Each digit
represents units ten times the unit of the digits to its right.
·
Take(125)10
for example:
125 = 5(100) + 2(101) + 1(102)
125 = 5(100) + 2(101) + 1(102)
·
Which gives
you 5 + 20 + 100 = 125.
Conversion from Decimal to Binary
Again taking the number 125 for
example:
(a)
Divide the decimal number by 2.
(b)
Write the remainder (which is either 0 or 1) at the right most position.
(c)
Repeat the process of dividing by 2 until the quotient is 0 and keep writing
the
remainder after each step of division.
(d) Write the remainders in reverse order.
*However, this method is tedious when you use it with a
large number, say 9542, therefore not recommended.
Alternatively, we can also:
1.
we know for
a fact that 125 is less than 128, which is 27.
2.
Therefore
the value would hold 7 bits _ _ _ _ _ _ _2
3.
Work it out
this way:
4.
125 – 26
= 61
5.
61 – 25
= 29 -> 1 1 _ _ _ _ _2
6.
29 – 24
= 13 -> 1 1 1 _ _ _ _2
7.
13 – 23
= 5 => 1 1 1 1 _ _ _2
8.
4 + 1 = 5 =
1(22) + + 0(21) + 1(20) -> 1 1 1 1 1 0 12
Converting Decimal Fractions to Binary
Take 0.75 for example.
1.
Multiplying
the decimal fraction by 2, you’d get 0.75 x 2 = 1.50
2.
If a
non-zero integer is generated, record the non-zero integer. Otherwise, record
0.
3.
Remove the
non zero integer, and repeat the procedures until the fraction value becomes
zero.
4.
In this
case, we would get
0.75 x 2 = 1.50
|
1
|
0.50 x 2 = 1.00
|
1
|
5.
Therefore
(0.75)10 would be (0.11)2
6.
Moreover, we
can write 125.7510 as (1111101.11)2
However, of you take 0.910,
notice that the multiplication and recording goes on and on without the
fraction ever becoming zero.
0.90 x 2 = 1.80
|
1
|
0.80 x 2 = 1.60
|
1
|
0.60 x 2 = 1.20
|
1
|
0.20 x 2 = 0.40
|
0
|
0.40 x 2 = 0.80
|
0
|
0.80 x 2 = 1.60
|
1
|
0.60 x 2 = 1.20
|
1
|
0.20 x 2 = 0.40
|
0
|
0.40 x 2 = 0.80
|
0
|
0.80 x 2 = 1.60
|
1
|
0.60 x 2 = 1.20
|
1
|
0.20 x 2 = 0.40
|
0
|
… and on and on and on…. D;
For this occasion, we can use
this alternative method:
1.
Multiply 0.9
by 27 -> 0.9 x 128 = 115.2 which is in decimal
2.
Round off
115.2, giving you 115
3.
Convert 115
to binary, which gives you 1110011
4.
At the end
of this, you’ll get (0.90)10 = (0.1110011)2,
which you will notice is the same as what you got above, in a much simpler method.
which you will notice is the same as what you got above, in a much simpler method.
Converting Decimal to Octal
Use the same process of converting
decimal to binary, but instead of
dividing by 2, divide by 8.
8
|
125
|
remainder
|
8
|
15
|
5
|
1
|
7
|
ð
(125)10
= (175)8
Converting Decimal Fractions to
Octal Fractions
Take 0.75 for example again ;}
however, instead of multiplying by 2, we multiply by 8
however, instead of multiplying by 2, we multiply by 8
0.75 x 8 = 6.00
|
6
|
Therefore 0.7510 would
be 0.68
Converting Decimal to Hexadecimal
Use the same process of
converting, but instead of 2 or 8, we divide the value by 16 instead.
16
|
125
|
remainder
|
16
|
7
|
13
|
0
|
7
|
Since the 13th unit in
hexadecimal is D,
(125)10 in hexadecimal
would be (07D)16
Converting Decimal Fractions to
Hexadecimal fractions
The same as how you convert
decimal to hexadecimal, you multiply by 16
0.75 x 16 = 12
|
12
|
Since the 12th unit is
C,
(0.75)10 would be
(0.C)16 in hexadecimal.
-Xin Lin B031210345
-Xin Lin B031210345
0 comments:
Post a Comment