In: Computer Science
In this question, you are provided with an IEEE-754 floating-point number in the form of 8 hexadecimal digits.
You are asked to decode this value into its decimal representation.
You MUST report your answer as a real number.
Do NOT use scientific notation.
Do NOT round or truncate your answer.
Do NOT add any spaces or commas to your answer.
If the converted number is positive, do NOT add the plus sign.
Convert, i.e., decode, 0x48801002 from the 32-bit single-precision IEEE-754 FP representation into decimal representation.
Answer: 262272.0625 Explanation: ------------- Hexadecimal Binary 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 1010 B 1011 C 1100 D 1101 E 1110 F 1111 Use this table to convert from hexadecimal to binary Converting 48801002 to binary 4 => 0100 8 => 1000 8 => 1000 0 => 0000 1 => 0001 0 => 0000 0 => 0000 2 => 0010 So, in binary 48801002 is 01001000100000000001000000000010 01001000100000000001000000000010 0 10010001 00000000001000000000010 sign bit is 0(+ve) exp bits are 10010001 => 10010001 => 1x2^7+0x2^6+0x2^5+1x2^4+0x2^3+0x2^2+0x2^1+1x2^0 => 1x128+0x64+0x32+1x16+0x8+0x4+0x2+1x1 => 128+0+0+16+0+0+0+1 => 145 in decimal it is 145 so, exponent/bias is 145-127 = 18 frac bits are 0000000000100000000001 IEEE-754 Decimal value is 1.frac * 2^exponent IEEE-754 Decimal value is 1.0000000000100000000001 * 2^18 1.0000000000100000000001 in decimal is 1.000488519668579 => 1.0000000000100000000001 => 1x2^0+0x2^-1+0x2^-2+0x2^-3+0x2^-4+0x2^-5+0x2^-6+0x2^-7+0x2^-8+0x2^-9+0x2^-10+1x2^-11+0x2^-12+0x2^-13+0x2^-14+0x2^-15+0x2^-16+0x2^-17+0x2^-18+0x2^-19+0x2^-20+0x2^-21+1x2^-22 => 1x1+0x0.5+0x0.25+0x0.125+0x0.0625+0x0.03125+0x0.015625+0x0.0078125+0x0.00390625+0x0.001953125+0x0.0009765625+1x0.00048828125+0x0.000244140625+0x0.0001220703125+0x6.103515625e-05+0x3.0517578125e-05+0x1.52587890625e-05+0x7.62939453125e-06+0x3.814697265625e-06+0x1.9073486328125e-06+0x9.5367431640625e-07+0x4.76837158203125e-07+1x2.384185791015625e-07 => 1+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.00048828125+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+2.384185791015625e-07 => 1.000488519668579 so, 1.000488519668579 * 2^18 in decimal is 262272.0625 so, 01001000100000000001000000000010 in IEEE-754 single precision format is 262272.0625 Answer: 262272.0625