Wednesday, January 9, 2013

Decimal to Hexadecimal

We are now going to look at Decimal to Hexadecimal converter. So let us understand what exactly a hexadecimal number and what its digits mean. So we are going to look at three digits of hexadecimal number the first unit represents units, which is 16 to the power of zero that is one. That represents units. The second digit represents tenths, which is 16 to the power of one. And the third digit represents hundredths, which is 16 to the power of two. That is nothing but 256. So important thing to do when one is working on how to convert a decimal to hexadecimal, is the start of working out how many hexadecimal number is going to have?

Let us understand it with an example, convert decimal to hexadecimal. Say number 74, here we need to decide, what we are going to and how many digits this hexadecimal number is going to have. Now because 256 is less than 74, there is any going to be two digits. So we now going to see, that in 16 to the power of one column, here we divide 74 by 16 and the result is 4. This means 4 times 16 is 64 and we have the remainder as 10. Now 10 is a single digit in a hexadecimal, simply represents a A , that tells us 74  = 4 A.

 Let us understand with a complicated example. This time it represents 680 as a hexadecimal number. Here that we see 680 is greater than 256 so we are going to have three digits in a hexadecimal number. What we going to do first is divide 680 by 256. And the result of that is 2. Two times 256 is 512, so our remainder is 168. Next we go back as what we did in our first example, we are going to divide 168 by 16. The result of this is 10. 10 times 16 equals to 160, as we are left with the remainder 8. Now we have three digits in hexadecimal number, thus we notice that we have 10, which is represented by ( A ) . This tells us that 680 when written as a hexadecimal number as 2A8. That is, 680 = 2A8. This is how we do a decimal to hexadecimal conversion. The method to do this is to keep on dividing the decimal number by 16 till it gets the most significant remainder.

No comments:

Post a Comment