Jul 25, 2008

How Do I Convert Hexadecimal To Decimal?

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > Assembler and Delphi

free web hosting

How Do I Convert Hexadecimal To Decimal?

Angela
Trying to learn assembly...

How do I convert a hexidecimal form to the decimal equivalent?

Notice from BuffaloHELP:
Topic title modified.

Reply

BuffaloHELP
Would you like to know it by hand so that you can calculate it anywhere or would you like to have a reference so that you can look it up?

The detailed converting technique can be summarized here http://www.permadi.com/tutorial/numHexToBin/index.html

Online conversion calculator can be found here http://www.statman.info/conversions/hexadecimal.html

The basic idea is this: when we count as decimal world (Base10) we don't "carry the number" until the 10th count. That is, by simpler words, we don't add to the next digit place until all 9 boxes are filled (counted). Why only 9? ZERO is not filled with anything. The amazing discovery of digit ZERO is for another story, but for counting it is very important. Assuming you understand the concept and importance of ZERO we continue...

Let's say you have 16 items. You have 10 boxes to fill in Base10 where each box is numbered from ONE to NINE. The box marked ZERO is omitted. You start to fill in and you notice that all nine boxes are filled with 6 items still in your hands. To make it easier, you empty out NINE boxes, add one more item from your hands to 9 items taken out and place it on the side. You've just counted 10 items and you continue to fill empty boxes with remaining items in your hands. This is what we call the "carry the one" and add the remainder. Therefore we get the usual number 16--ONE complete set was filled and still had 6 left over.

This "carry the one" does not happen in Base16 until the box number 15 (counting from ZERO to FIFTEEN will result in 16 counts, counting formula = (15 - 0) + 1 OR (n2-n1)+1 ). So you don't "carry the one" until 16th count. The number 17 means "carry the one" and still have remainder of 1. This is represented as 11 in Base16. 20 is represented as 14 in Base16.

What's up with letters? Since counting only consists of a single digit representation, letters A, B, C, D, E, F were added as digits beyone 10 in Base10 world. So what we understand as 11 in decimal would be A in hexadecimal. It's like having 16 fingers smile.gif

A quck counting exercise you can do at home:
Use both hands and one foot to count objects. To make it easier mark your toes with letters A thru E. When you count up to letter F, instead of counting, write it as "1" on a piece of paper. laugh.gif Do try this exercise only if you want to...

Basice decimal to hexadecimal calculation by hand:
Pick a decimal. If decimal is larger than 16, divide decimal (d) by 16. Take the integer of dividend (h) and multiply by 16. Subtract this result from decimal (d) and find the remainder. Match the remainder as Base16.

d = 100
100 / 16 = 6.25
6 * 16 = 96
100 - 96 = 4 (hex for 4 is 4)
result = 64 Base16

So to convert from hexadecimal to decimal, all you have to do is multiply 16 with second digit and to left, plus the remainder. For example:
hexadecimal (h) = 5A
16 * 5 = 80
A in decimal = 10
80 + 10 = 90 in decimal

I hope this helped.

 

 

 


Reply

iGuest
How do I convert Hexidecimal to Decimal
How Do I Convert Hexadecimal To Decimal?

This technique works for any number base. A number base is also called a 'Radix';

X is the number we are converting to the new radix.
Digits is an array of bytes that will hold the result.
The digits will be in reverse order, so, we'll have to reverse the
Contents of Digits when we're done.
[code]
Len := 0;
Repeat
Q := X div Radix;
are := X mod Radix;
Digits[Len] := are;
Len := Len + 1;
X := Q;
Until X = 0;

If Len > 1 then
Begin
I := 0;
J := Len - 1;
repeat
B1 := Digits[I];
Digits[I] := Digits[J];
Digits[J] := B1;
Inc(I);
Dec(J);
until I >= J;
End;

[/code]

Let's test the theory:

7F23 => ? in Radix 10 (radix 0a)

7F23 div 0A = CB6
7F23 mod 0A = 7 Digits[0] = 7

CB6 div 0A = 145
CB6 mod 0A = 4 Digits[1] = 4

145 div 0A = 20
145 mod 0A = 5 Digits[2] = 5

20 div 0A = 3
20 mod 0A = 2 Digits[3] = 2

3 div 0A = 0
3 mod 0A = 3 Digits[4] = 3

Digits contains {74523}
Reversing Digits yields {32547}

I hope this helps.

All The best,
:Flubbo.

-reply by flubbo

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. hexa to decimal conversion - 0.56 hr back. (1)
  2. how to convert hexadecimal to decimal easily - 0.57 hr back. (1)
  3. how to convert hexadecimal to decimal - 0.61 hr back. (1)
  4. convert hex to deci - 0.67 hr back. (1)
  5. hex covert to decimal - 1.87 hr back. (1)
  6. decimal to hexadecimal converter - 3.41 hr back. (2)
  7. how to do hexadecimal conversion - 5.77 hr back. (1)
  8. converting hexadecimal - 6.17 hr back. (1)
  9. converting hexadecimal to decimal - 6.90 hr back. (1)
  10. how to convert decimal to hexadecimal - 7.09 hr back. (1)
  11. hex decimal letters - 7.36 hr back. (1)
  12. large hex decimal converter - 11.22 hr back. (1)
  13. hexidecimal to decimal - 19.23 hr back. (1)
  14. converting hexidecimal to decimal - 21.75 hr back. (1)
Similar Topics

Keywords : convert, hexadecimal, decimal

  1. Need Help To Convert Code To Delphi
    (0)


      Looking for convert, hexadecimal, decimal

Searching Video's for convert, hexadecimal, decimal
advertisement



How Do I Convert Hexadecimal To Decimal?



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE