public static void Main()
float value = halfToFloat(0x7c00);
Console.WriteLine("Result passing 0x7C00:" + value);
static float halfToFloat(int hbits) {
int mant = hbits & 0x03ff;
int exp = hbits & 0x7c00;
if (mant == 0 && exp > 0x1c400) {
temp = (hbits & 0x8000) << 16 | exp << 13 | 0x3ff;
return BitConverter.ToSingle(BitConverter.GetBytes(temp), 0);
} while ((mant & 0x400) == 0);
temp= (hbits & 0x8000) << 16 | (exp | mant) << 13;
Console.WriteLine("INT:{0:x}" , temp);
return BitConverter.ToSingle(BitConverter.GetBytes(temp), 0);