Showing posts with label number systems. Show all posts
Showing posts with label number systems. Show all posts

Difference between octal and hexadecimal

 

Difference between Octal and Hexadecimal

We have already studied the octal number system and hexadecimal number system and worked on few solved examples to understand the representation of octal numbers and the representation of hexadecimal numbers.

Octal vs Hexadecimal Comparison

Hexadecimal NumbersOctal Numbers
It uses 16 different symbols or digits for representing hexadecimal numbers, [0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F].Octal numbers use only 8 symbols or digits to represent all the octal numbers. Therefore, it can have digits from 0 to 7 only.
The radix or base for hexadecimal numbers is 16.The radix or the base for octal number is 8.
Easier to represent and remember large numbers.Easy to represent using octal number system but difficult to remember large numbers.
Example of Hexadecimal number: FF (Equivalent to Two hundred and fifty-five in decimal)Example of Binary number: 377 (Equivalent to Two hundred and fifty-five in decimal)
It takes 4 bits or 4 Binary digits to represent a single Hexadecimal digit.It takes only 3 bits or 3 Binary digits to represent an Octal digit.
Since the hexadecimal number system uses 16 digits, the arithmetic and logical operations could become complex.On the other hand, the Octal number system uses a lesser number of digits (8). This makes performing arithmetic and logic operations easy compared to the hexadecimal number system.
Representing large decimal numbers in the hexadecimal number system is easier.Representing large decimal numbers in octal becomes difficult and large.
octal vs hexadecimal

 

Difference between binary and hexadecimal

Hexadecimal Numbers Binary Numbers
Hexadecimal numbers make use of 16 symbols 0 to 9 and additional symbols (A, B, C, D, E, F). Hexadecimal numbers were introduced with the purpose to represent binary numbers in a more human readable form.                 Binary numbers make use of only 2 symbols (0, 1) to represent any number and it becomes a tedious job to express large numbers.
The radix or base for hexadecimal number is 16 and each symbol in a hexadecimal number is expressed as power of 16. The radix for binary numbers is 2 and also termed as base 2 numbers.
It is easy and more human readable to represent number in hexadecimal system.Large numbers represented in binary system are not in a human readable form.
Example of  Hexadecimal number : FF (Equivalent to Two hundred and fifty five in decimal)Example of Binary number : 11111111 (Equivalent to Two hundred and fifty five in decimal)
Applications
  • Used for representing addresses of memory locations in microprocessors and assembly language programming.

Applications
  • All the digital circuits use binary numbers at the lowest level of interaction and to perform logical operations.



Representation of octal number




Representing a number in the octal number system follows the same steps that we have seen in decimal and binary number system, the only difference here is the weights used in octal number system are powers of 8 and the values that are assigned to the weights range from 0 to 7. In this system it is not permitted to use the digits beyond 7.









Note: In this number system 20 is not equal to twenty but its equal to twenty four in decimal.

Let us take a simple example 1034 in decimal number system and (2012) its equivalent number in the octal number system, we will not worry much about how we got the octal equivalent at this moment and concentrate on how we represent in octal number system.


Step 1: ( 2 0 1 2 )8
Here subscript 8 indicates the number is in octal number system

We will now write down the weights in the form of table without assigning the values as shown below


    83      82       81       0                 ← Weights in octal number system
                                  
    ↑                             ↑
MSD                          LSD


Step 2 : The values are assigned starting from LSD to MSD, the right most digit in the given example is LSD and the left most digit is MSD as done below :


    83       82       81       0                 ← Weights in octal number system
   2      0       1      2    
    ↑                             ↑
MSB                          LSB

Step 3: Multiply the values and the associated octal weights shown below 

Beginning from LSD to MSD

2 x 0    LSD             ← (1)
1 x 1                                  ← (2)
0 x 2                                  ← (3)
2 x 3   ← MSD             ← (4)



Step 4: Add the products (1), (2), (3), (4) from step 3 as illustrated below

       2 x + 0 x + 1 x + 2 x 0

 =    2 x + 0 x + 1 x + 2 x 0
        ↑                                          ↑
      MSB                                    LSB

=    2 x 512 + 0 x 64 + 1 x 8 + 2 x 1


=    1024 + 0 + 8+ 2


=    ( 1034 )10 


Octal number system

Octal number system uses eight symbols or digits to represent any octal number
 
This number system uses only the digits ranging from zero( 0 ) to seven( 7 ) for counting as well as performing various arithmetic operations.
Even though the name of the number system is octal number system, the digit 8 is not used in this number system.

The radix or base in octal number system is 8 since it involves eight ( 8 ) symbols.

In this number system the weights are all powers of 8.


The generic format for representing any number in binary number system is as show below

    84    83        82      81      80           8-1     8-2      8-3      8-4           Weights
  S   S   S   S   S  .   S-1    S-2    S-3    S-4  
                                              ↑                                     
MSD                               Octal point                       LSD




where 
             MSD i the most significant digit
             LSD is the least significant digit


             S1 ,S2 ,S3 ....Sn are values assigned.


Representing larger numbers in binary number system was a difficult task and hence the other two number systems namely octal number system and hexadecimal number system were introduced.

Representation of binary number

Representing a number in the binary number system follows the same steps that we had earlier followed to represent a decimal number, except for the fact that the weights used in binary number system are powers of 2 and the values that are assigned to the weights can take only two values either zero's (0) or one's (1).

Let us take a simple example 13 in decimal number system and (1101) its binary equivalent, we will not worry much about how we got the binary equivalent at this moment and concentrate on how we represent in binary number system.


Step 1: (1101)2
Here subscript 2 indicates binary number system

We will now write down the weights in the form of table without assigning the values as shown below


    23      22       21       0                 ← Weights in binary number system
                                  
    ↑                             ↑
MSB                          LSB


Step 2 : The values are assigned starting from LSB to MSB, the right most bit in the given example is LSB and the left most bit is MSB as done below :


    23       22       21       0                 ← Weights in binary number system
   1      1       0      1    
    ↑                             ↑
MSB                          LSB

Step 3: Multiply the values and the associated  binary weights shown below 

Beginning from LSB to MSB

1 x 0    LSB             ← (1)
1 x 1                                  ← (2)
1 x 2 2                                  ← (3)
1 x 3   ← MSB             ← (4)



Step 4: Add the products (1), (2), (3), (4) from step 3 as illustrated below

       1 x 2 + 1 x + 0 x + 1 x 0

 =    1 x + 1 x + 0 x + 1 x 0
        ↑                                          ↑
      MSB                                    LSB 

=    1 x 8 + 1 x 4 + 0 x + 1 x 1


=    8 + 4 + 0 + 1


=    ( 13 )10 


Decimal number fraction

In this we will learn how to represent a decimal number with the fractional part. For this we take the following example :

Example 1: (75.65)10

Step 1: First we take the weights and put it in the format specified in the decimal number system done below


    101    100                   10-1    10-2         ← Weights
                    .                      
                        ↑
                 Decimal point

Since the example above contains fractional part we must include the radix point or the decimal point.

Step 2: Values are assigned to the corresponding weights before and after the decimal point as shown below:


    101    100                  10-1      10-2         ← Weights
    7    5              6        5      
                        ↑
                 Decimal point



Step 3: Now calculate the product of the values and associated weights as shown

7x101
5x100
.
6x10-1
5x10-2

Step 4: Sum the products obtained in step 3 accordingly on the either side of the decimal point as illustrated below

    7x101  + 5x100  .   6x10-1  + 5x10-2

=  7x10  + 5x1  .   6x(1/10)  + 5x(1/100)

=  70  + 5  .   (6/10)  + (5/100)

=   75  .   0.6  + 0.05

=  (75  .  0.65)10



Some more examples that you can try


  1. (154.97) 10
  2. (1.1) 10
  3. (0.984) 10
  4. (800.007) 10

Representation of a decimal number

We will take a simple example to represent decimal number in a format clearly showing how the weights and the associated values form the decimal number. The following examples will make it easier for you to understand how the wights and the values are assigned in other number systems.

Example 1: Represent 592 in decimal number system
We also write it as (592)10
Where the subscript 10 indicates that the its a decimal number.

Step 1: For a given number first write down the weights for the decimal number system as shown below

    102    101    100        ← Weights
                         

Here decimal point is not required since fractional part does not exist.

Step 2: Now assign values to the weights starting from right to left such that LSD has the smallest weight and MSD has the greatest weight.


   102    101    100        ← Weights
    5     9      2   
    ↑                  ↑
MSD             LSD


Step 3: Multiply each value with its corresponding weights as shown below

5x102
9x101
2x100


Step 4: Compute the sum of the products obtained in Step 3 as shown below

   5x102  + 9x10+ 2x100


= 5x100 + 9x10 + 2x1


= 500 + 90 + 2


=(592)10



Decimal number system

Before I introduce the number systems that are more commonly used in electronics lets discuss a number system that we all are aware of and which we use it everyday.
The Decimal number system got its name because it uses 10 symbols (or popularly digits) for counting and performing operations. It uses the digits 0 to 9.
In this number system the radix or the base is 10 since number of digits used is ten.

The general format of decimal number representation is shown below


  104    103    102     101    100          10-1    10-2   10-3    10-4           Weights
  S   S   S   S   S  .   S-1    S-2    S-3    S-4  
                                              ↑                                     
MSD                               Decimal point                    LSD


Where
           MSD is most significant digit (left most digit of a number)
           LSD is the least significant digit (right most digit of a number)

Note: From the fig we can observe that the MSD has the greatest weight and the LSD have the smallest weight.

Frequently asked Questions

  • In decimal number system, What is MSD? 
Ans:  MSD is Most Significant Digit which is usually the left most digit of any given number and has the highest weight compared to all other digits.

Number Systems

A number system is simply a methodology which includes a set of rules and symbols for counting, or performing operations like addition, subtraction, multiplication, division.

In earlier days, Our ancestors used pebbles to count and keep track of their accounts which is also a number system that existed thousands of years ago.

Similarly, Today though we do not use pebbles we use symbols (also called digits) in our number systems which is widely used in Electronics & Communication systems and computers.


The general format of a number is as shown below:


S6 S5 S4 S3 S2 S1 S0 . S-1 S-2 S-3S-4S-5
                                 (Radix point)
Where S stands for the radix or base of a particular number system.
S0 has a weight of 0, S1 has a weight 1, S2 has a weight 3 .......

Radix: It is the number of digits(or symbols) that are used in the number system.
The Radix point also known as base point.
Depending on the kind or number of symbols we use for counting and performing various operations we have different types of number systems as follows.
  1. Decimal number system
  2. Binary Number System
  3. Octal Number System
  4. Hexadecimal Number System

 

comments powered by Disqus