1. ## decimals to hex

could anybody please tell me how to convert 0.00001 to hexadecimal value.

2. You gotta be kidding. The name of the topic just below this one, when I saw this was :
"hex to dec in c"

3. Actually, this is NOT the same question as the other post.

There are two ways to look at this:
First, you could be just wanting to write the number as a hexadecimal representation of the number:
Hexadecimal representation of floating point (or fractions of) numbers is pretty much the same principle as decimal ones, you have to divide by one base and multiply by the other, taking a portion off at a time. But I don't REALLY see the point (aside from as a "fun excercise" [if you like that sort of thing]), because there is really no practical use of hex "floats". Hex is used to represent integer values because it's a practical way to describe the binary value without writing a whole lot of digit (8 vs 32). Unless you are really skilled in "decimal to binary", you won't be able to say which bits are in decimal number 4711, but with a little bit of practice, you can quite easily convert 1267 into 0001001001100111 (that's 4711 if you convert it back to decimal). But fractions or floating point numbers don't have a practical application in hex.

Second option:
You could be wanting to write the hexadecimal representation of the floating point number as a 32-bit value from memory. This would involve taking the address of the float and cast the resulting pointer to an integer-type, then print the integer as hex. This can be useful if you have a memory dump of something that is floating point, or some such thing. Not very practical for much else...

--
Mats