The question makes no sense, because a number cannot be "hexadecimal" or "decimal", only a string representation of a number can be. But a string cannot be "64-bit".
Your code sample is basically correct, but you cannot "convert" it to the code returning int32, by a very simple reason: the type
double
is 64-bit, it cannot be fit in 32 bits:
http://en.wikipedia.org/wiki/IEEE_floating_point[
^].
[EDIT]
You don't need a special conversion. General-case conversions are to array of bytes and from array of bytes. This is a main purpose of this class. In your case:
internal static string ToHex(float value) {
byte[] bytes = BitConverter.GetBytes(value);
uint intValue = BitConverter.ToUInt32(bytes, 0);
return intValue.ToString("X");
}
—SA