public static double IEEE754Float(byte [] data, int i)
{
int s;
int e;
double m;
double m_dblReturn = 0;
s = data[i + 2] & 128;
e = (data[i + 2] & 127) * 2 + (data[i + 3] & 128) / 128;
m = (Convert.ToDouble((data[i + 3] & 127)) * 65536 + Convert.ToDouble(data[i]) * 256 + Convert.ToDouble(data[i + 1])) / 8388608;
m_dblReturn = Math.Pow((-1),s) * Math.Pow(2 , (e - 127)) * (m + 1);
return m_dblReturn;
}
public static double IEEE754Float(string p_strValue)
byte [] data = new byte[4];
data[0] = Convert.ToByte(p_strValue.Substring(0,2),16);
data[1] = Convert.ToByte(p_strValue.Substring(2,2),16);
data[2] = Convert.ToByte(p_strValue.Substring(4,2),16);
data[3] = Convert.ToByte(p_strValue.Substring(6,2),16);
s = data[2] & 128;
e = (data[2] & 127) * 2 + (data[3] & 128) / 128;
m = (Convert.ToDouble((data[3] & 127)) * 65536 + Convert.ToDouble(data[0]) * 256 + Convert.ToDouble(data[1])) / 8388608;
}