Jump to content
xisto Community
Angela

How Do I Convert Hexadecimal To Decimal?

Recommended Posts

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 :)

 

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. :rolleyes: 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.

Share this post


Link to post
Share on other sites

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.

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 thenBegin  I := 0;  J := Len - 1;  repeat    B1 := Digits[I];    Digits[I] := Digits[J];    Digits[J] := B1;    Inc(I);    Dec(J);  until I >= J;End;

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

Share this post


Link to post
Share on other sites
General Formula for Dec to HexHow Do I Convert Hexadecimal To Decimal?

I managed to work out something using Bases 10 and 2, 2 bases I know well.

I got THIS:

Base x, place value p, number value (in Base x) q, and  number value (in base 10) V,

V = q((x^p)/x)

Of  course, this formula requires you to break down the values into their respective place values.

Theory in test: My calculator showed me 45 in Base 16 is 69 in Base 10. Let's try this out...

5((16^1)/16)

=5(16/16)

=5(1)

=5

4((16^2)/16)

=4(256/16)

=4(16)

=64

64+5

=69

Correct!

Hope this will work!

-reply by MathsPro

Share this post


Link to post
Share on other sites
Mscomm How Do I Convert Hexadecimal To Decimal?

I developed weighing scale software in vb...My two indicator showing correct value in vb...But third indicator showing like 0.2330 , 2330.0 ...I checked with html line , there showing 0.2330...But my scale showing 002330kg...How I can get same value in vb ...I am using mscomm

Regards

antony

-question by ANTONY MARTIN

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.