I'll start with the assumption that a given nonzero number is a machine double, and we want to show the hex string for either 32 or 64 bit format. We give as parameters the exponent field size and the total number of hex digits for the result.
toHex[n_Real, esize_Integer, hlen_Integer] /;
Precision[n] === MachinePrecision && n != 0 := Module[
{mant, exp, sgn, bits, hexdigits, rule},
{mant, exp} = RealDigits[n, 2];
mant = Rest[mant];
sgn = If[n > 0, {0}, {1}];
exp = IntegerDigits[exp + 2^(esize - 1) - 2, 2, esize];
bits = PadRight[Flatten[{sgn, exp, mant}], 64];
hexdigits = Take[IntegerDigits[FromDigits[bits, 2], 16, 16], hlen];
rule = Thread[Range[10, 15] -> Characters["abcdef"]];
Apply[StringJoin, Map[ToString, hexdigits /. rule]]
]
In the examples, 32 bit floats means 8 hex digits total, and the standard exponent width is 8 bits.
toHex[.25, 8, 8]
(* Out[174]= "3e800000" *)
For 64 bit floats the exponent field is 11 bits.
toHex[.25, 11, 16]
(* Out[175]= "3fd0000000000000" *)
I will add the disclaimer that, unless one is a good speller, it might be unwise even to attempt to hex a decimal...