Thursday 22 March 2018

Number System-DLD


Prepared by: Saad Aslam





Number  System
Radix or Base a number System:
Base or Radix of number system is the no symbols used in its representations .
For example:
·         Decimal number  system  has 10 symbols
0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 hence Radix or Base is 10
·         Binary number system has symbols 0 or 1
Therefore radix is 2
·         Octal number system has 8 symbols
0 ,1, 2, 3, 4, 5, 6, 7 therefore Rdix or Base is 8
·         Hexadecimal number system has 16 symbols
0 ,1 ,2, 3………………..,15 .Therefore Radix is 16


Common Number Systems
System
Base
Symbols
Used by Humans?
Used by Computers?
Decimal
10
0,1,2, . . . . ,9
Yes
No
Binary
2
0 , 1
No
Yes
Octal
8
0 , 1 ,2 , . .  . ,7
No
No
Hexadecimal
16
0 ,1,2,  . . . ,9 ,A ,B, C , . . ,F
No
No


In general ,a number can be expressed in  Base-r   system  as
an r+ an-1rn- 1+ .………………… + a0r+ a-1r-1 + a-2r-2 +…………………....+ a-mr-m
For example:
2 3 4 6 . 5 9
2*103 + 3*102 + 4*101 + 6*100 + 5*10-1 + 9*10-2  =2346.59
Types of Number Systems
Commonly used number systems are:
1.      Decimal Number System
2.      Binary Number System
3.      Octal Number System
4.      Hexadecimal Number System
Conversion of Bases
1.      (A)Decimal number system to other Number Systems
(B) Other Number Systems to Decimal Number Systems
2.      (A)Binary  number system to other Number Systems
(B)Other Number Systems to Binary Number Systems
3.      (A)Octal number system to other Number Systems
(B) Other Number Systems to Octal Number Systems
4.      (A)Hexadecimal  number system to other Number Systems
(B) Other Number Systems to Hexadecimal Number Systems



1.     (A) Decimal to other Number Systems
Decimal to Binary
Q.Convert the decimal 18 to Binary Number System.
                                                2       18                                              
                                                2        9  -- 0                                       
                                                2        4  -- 1
                                                2         2 -- 0
                                                            1 -- 0

Note: Binary has two Base “2” so divide 18 by 2.
(18)10=(10010)2

(1 0 0 1 0)2
                                                                   MSB                           LSB
If there is a fractional value:
Q: Convert the following decimal fraction to binary fraction
·         (0.625)10                              
·         (0.18725)10
(0.625)10
If the fractional value is given then you have to multiply by “2” as
                                                           Real Part     Decimal Point     Fractional Part
0.625*2                                                 1                         .                            25  
0.25*2                                                    0                        .                            50
0.50*2                                                   1                         .                            00

                    (0.625)10  = ( . 101)2

·         Do this by yourself (0.18725)10  into Binary Number System

Decimal to Octal
Q: Convert the following Decimal to Octal Number System
·         (172.878)10
Sol:
First take Real Part 172 and divide by 8
                                                                   8        172
8         21 --  4
8          2  --  5
(254)8
Now take Fractional Part and Multiply by 8
                                                             Real Part     Decimal Point     Fractional Part
0.878 * 8                                                7                         .                            024
0.024 * 8                                                 0                        .                            152
0.152 * 8                                                 1                         .                            536
0.536 * 8                                                 4                         .                            288
Solve upto 4 digits
 (0.878)10   = ( . 7014)8
So, (172.878)10 = (254.7014)8

Decimal to Hexadecimal
Q:Find the value of x
   (786.983)10    =  ( x )16
Sol:
This type of question mean to convert decimal to Hexadecimal
                                                                      16     786
16       49 – 2
16        3  -- 1
 (786)10 =    (312)16
                                                         
                                                       Real Part     Decimal Point     Fractional Part
0.983 * 16                                        15 = F                         .                            728
0.728 * 16                                        11 = B                         .                            648
0.648 * 16                                        10 = A                         .                            368
0.368 * 16                                                5                          .                            886
(.983)10 = (.FBA5)16
So,
(786.983)10 = (312.FBA5)16

Q: Convert (82.35)10 to base 4 number system.
Sol:
                                    4      82
                                    4       20 – 2
                                    4        5  -- 0
                                              1 – 1

 (82)10 =    (1102)4
                                      Real Part     Decimal Point     Fractional Part
0.35 * 4                           1                         .                            40
0.40 * 4                           1                         .                            60
0.60 * 4                           2                         .                           40
0.40 * 4                           1                          .                          60
(.35)10 = (.1121)4
So,
(82.35)10 = (1102.1121)4
(B) Other Number Systems to Decimal Number Systems
Binary to Decimal
: Convert the Binary number 11010.011 to decimal
Sol:
= 1*24 + 1*23  + 0*2 +  1*21  +  0*2 +  0*2-1  +  1*2-2  +  1*2-3
= 16 + 8 + 0 + 2 + 0 + 1/4  + 1/8
( 26.375 )10  Ans
Octal to Decimal Number System
Q: Convert the following Octal to Decimal Number System
(763.45)8
Sol:
= 7*82 + 6*81  + 3*8 +  4*8-1  +  5*8-2  
= 7*64 + 6*8 + 3 + 4/8 + 5/64
(499.5781 )10  Ans

Hexadecimal to Decimal Number System
Q: Convert the following Hexadecimal to Decimal Number System
(ABC.75)16
Sol:
= A*162 + B*161  + C*16 +  7*16-1  +  5*16-2  
= 10*256 + 11*16 + 12 + 7/16 + 5/256
(2748.457 )10  Ans
2.      (A)Binary  number system to other Number Systems
Binary to Octal
Technique
·         Group bits in threes ,starting on right before decimal point and from left after decimal point.
·         Convert to Octal digits
Q: Convert the following Binary Number to Octal
a)(1011011.011011)2                                                       b)(1101.00101)2
a)(1011011.011011)2
sol:
Make 3,3 pairs
                       001   011   011 . 011   011
                      1        3        3    .   3       3
=(133.33)8  Ans
b) (1101.00101)2
                            001   101 . 001   010
                         1        5    .  1        5
=(15.15)Ans

Binary To Hexadecimal
Technique
·         Group bits in fours ,starting on right begore decimal point and from left after decimal point.
·         Convert to Hexadecimal digits

Q: (10111011.011011)  to ( x )16
Sol:

                              1011  1011  .  0110  1100
                               B         B      .     6         C
=(BB.6C)16

Hexadecimal to Octal Number System
Technique
·         Use Binary as Intermediatry
Q:Convert the following hexadecimal to Octal Number System
a)      1A5B                                   b) A246.39

a)      1A5B
Sol:  First convert the Hexadecimal to Binary
                                1          A        5        B
                               0001   1010  0101  1011
       Then making pairs of 3 bits starting from right to left                                                 
                                   000 001   101  001  011  011       
                                   0      1       5       1      3       3
=(15133)8
b)     A246.39
Do by yourself

Conversion of Any Number System to any other Number System
Technique:
·         Convert the first base to decimal, by multiplying with base given and taking powers.
·         Then convert the decimal number system to the specified base by dividing with the base
Q:Convert (124)5  to ( x )12
Sol:
First convert into Decimal
=1*52 + 2*51 + 4*50
=25 + 10 + 4
=( 39 )10
Now Perfom the following process with base 12
                                           12       39
                                                       3 --- 3

=( 33 )12
Note:
All conversions are described in the above examples . Therefore, part 3 and 4 is not written separately.


Exercise
Convert the following given number system to other number systems
Decimal
Binary
Octal
Hexadecimal
33
?
?
?
?
1110101
?
?
?
?
703
?
?
?
?
1AF

0 comments:

Post a Comment