Like this:
private Single ConvertHexToSingle (string hexVal) {
try {
int i=0, j=0;
byte[] bArray = new byte[4];
for (i = 0; i <= hexVal.Length-1; i += 2) {
bArray[j] = Byte.Parse (hexVal[i].ToString() + hexVal[i + 1].ToString(), System.Globalization.NumberStyles.HexNumber);
j += 1;
}
Array.Reverse (bArray);
Single s = BitConverter.ToSingle (bArray, 0);
return (s);
} catch (Exception ex) {
throw new FormatException ("The supplied hex value is either empty or in an incorrect format. Use the " +
"following format: 00000000", ex);
}
}
Good luck!
comes from this page by the way:
http://weblogs.asp.net/craigg/archive/2006/09/25/Hexadecimal-to-Floating-Point-_2800_IEEE-754_2900_.aspx[
^]