# Converting decimal number to a hexadecimal number

I'm trying to represent the number 12.25 in various bases. So without normalizing:

For Binary:

   12    - > 1100
0.25  - > .01  (1 * (1/2)^2)
so 12.25   = 1100.01


For Hex :

   12    - > C
0.25  - > .4   (4 * (1/16)^1)
so 12.25   = C.4


and then the decimal point has been shifted in conjunction with an exponent term.

But I'm not sure how to convert 0.25 decimal to hexadecimal 0.4. I need to accomplish this without using a calculator. Any advice?

-
You mean "radix point", not "decimal point". – Dan Apr 20 '12 at 12:59

One good way is to express your number as a fraction, and then "count the number of $1/16$'s. Here, il would give $$0.25=\frac{1}{4}=\frac{4}{16}=4*\frac{1}{16}$$ And this is true for any number that admits a finite hexadecimal expression : you make it a fraction, with a power of 16 at the denominator, then separate your fraction in chunks with nominator a integer between 0 and 15, and denominator a power of 16. Then the nominators give the hexadecimal decomposition.