deadlock Message Board
[ July Full List | Reply ]

Re: Hex conversion formula
From Todd Harris on 4 Nov '00
replying to Re: Hex conversion formula posted by Jim

>>I'm looking for the conversion formula for hex to decimal.
>
>Use Windows Calculator...
>
>From your Start menu, do Run... and enter the word calc.
>
>Put it in "scientific" view, switch to the Hex option, type
>in your Hex number, then switch to Dec mode and it'll show you
>the conversion.

If you actually want to know how to do the conversion you have to do the base number thing. Hex has a base number of 16, as opposed to 10 for decimal. So it looks like this 1,2,34,5,6,7,8,A,B,C,D,E,F up to 15 for F. A=10, B=11, etc.
Anyhow, the way you convert is like this:

Example Decimal 1965

7(16^2) + 10(16^1) + 13(16^0) = 7(256) + 10(16) + 13(1) =
1792 + 160 + 13 = 7AD

I got 7(16^2) by dividing 1965 by 256( 256 or (16 * 16 = 256), is the highest number of a power of 16 that will go into 1965, IE: 16^3 is 4096, and 16^1 is 16 ) so you then take 256 and multiply it by the 7 equaling 1792. 1965 minus 1792 is equal to 173, the remainder. 16 goes into 173 10( or A in hex ) times ( 16^1 or 16 *1 ) leaving a remainder of 13 or D. Thus the answer is 7AD.

This is the long method, but there are plenty of formula's that you can make using the ideas here. I think the best thing to do is do it the long way or use a conversion tool. Not many people even know how to do the conversions anymore.








Reply to this message

Required Details
Your name:
Subject:

Optional Details
Home page title:
Home page URL:
Email:
(if you'd like to receive automatic replies by email)

Your Message