I need help with finding algorithm converting hex to IEEE-754 single-precision floating point number (without coding). I couldn't find any on the internet :(
For example, given input string 0xB9CD542, we need to return string 0x1.39aa84p-104 where last number is in hexadecimal exponential form (single precision floating point number) rounded to 0
OK, I'll bite:
If
0xB9CD54(binary00000000101110011100110101010100) is an IEEE-754 single-precision number, then it can be decomposed as follows:Sign bit =
0, so number is positiveBiased exponent =
00000001, so unbiased exponent is-126Mantissa (including implied leading
1) =101110011100110101010100=0xB9CD54Shifting the mantissa left by 1 so that it starts with
1.gives1.739AA8.So we end up with
0x1.739AA8p-126.Conversely, the decimal form of
0x1.39aa84p-104would seem to be0xb9CD542according to this site. So it looks like you need to check your sources!