Search code examples
hexdecimalieee-754floating-point-conversion

What is the decimal equivalent of the 32-bit IEEE floating point value CC4C0000?


First thing I do is to convert it into binary and so I get

CC4C0000 = 1100 1100 0100 1100 0000 0000 0000 0000

Now I know the number is negative because the sign bit (the first bit in the binary representation is 1).

And the exponent is the next 8 bits which is 10011000 which is equal to 2^7 + 2^4 + 2^3 = 128 + 16 + 8 = 152

Now the fractional part is the remaining 23 bits 100 1100 0000 0000 0000 0000.

Now here is my question , what is the true exponent ?

It should be 152-127 = 25 right ?

The fractional part is .100 1100 0000 0000 0000 0000

And after reinserting the leading one we have 1.100 1100 0000 0000 0000 0000.

Now I know that .100 1100 0000 0000 0000 0000 is equal to 0.59375

And so the final answer should be -1.59375 x 2^25.

But why it is not the correct answer.

When I put cc4c0000 in this url

http://www.h-schmidt.net/FloatConverter/IEEE754.html

The answer is different , where is my error if any ?

Thanks for any help :)


Solution

  • Your train of thought is correct and you did not make any mistakes.

    -1.59375 * 2^25 = -53477376

    Which is exactly the answer the webapp you linked gives me. Double check that you didn't make any silly errors during the final multiplication.