CompAddict

Welcome to our blogger...:-)

Sunday 21 October 2012

Chapter 1 Number System 1.5 Hexadecimal Number Operation


CHAPTER 1 : NUMBER SYSTEM

1.5 : Hexadecimal Number Operation
by : Muhammad Azmil Bin Ariffin B031210006


Hexadecimal Addition

Hexadecimal basic concepts:       
  1. Hexadecimal is base 16. 
  2. There are 16 digits in counting (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F)
  3. When you reach 16, you carry a “1” over to the next column
  4. The number after F (decimal 15) is 10 in hex (or 16 in decimal)


Use the following steps to perform hexadecimal addition:

1.          Add one column at a time.

2.          Convert to decimal and add the numbers.

3a.        If the result of step two is 16 or larger subtract the result from 16 and carry 1 to the
             next column.

3b.        If the result of step two is less than 16, convert the number to hexadecimal.

Example : 5816  + 2216                                                                                                 A = 10
                             5 816                                                                                        B = 11
                             2 216                                            C = 12                                  
                           
--------------                                                                                                                                       D = 13
                               7 1016 ----->7A16                                                                E = 14
                                                                                                                         F = 15
                        2B16 + 8416                                                  C = 12
                              2 B16                                                                                        D = 13
                              8 416                                                                                         E = 14
                                        ------------------                                                                                                                                F = 15
                            10 1516 ----->AF16
                           
Hexadecimal Subtraction

Example:    

In example, shows the subtraction of hexadecimal number operation. Firstly, we have to convert the hexadecimal number to binary. Then, take the 2's complement of the binary number and change it back to hexadecimal number. Add both numbers to get the result.                             
           8416 - 2A16
       2A16 = 00101010
       2's complement of 2A16 = 0101010 ----> 11010101
                                                                +             1
                                                                      ------------------------------
                                                                  11010110 = +D610  
              
                   8 416             Add
                               D 616
                                   
-------------------
                 15 A16

               
       C316 - 0B16
                   
0B16 = 000010112
                 
2's  complement of 0B16 = 11110101 = F516

                  C 316
               + F 516
                                                 -------------------
                1B 816
            
        A8316 - 43B16
                      A 87 31316
                 +    4 3 B16
                                                                 ------------------------
                       6 4 816                           


                               
                                    
                  

                                     
                                                                                
                                                                                                      
                                                                         

                


No comments:

Post a Comment