# Hex Bit Pattern to IEEE 754 standard Floating Point Number

The question asks for the decimal number that 0x0C000000 represents if it is a floating number. I'm not too sure on how to approach this, but here's my thought process:

0x0C000000 = 0000 1100 0000 0000 0000 0000 0000 0000

The first digit is 0, so it's positive. The exponent is 0x0C = 12 - 127 = -116. The mantissa is 0x0C0000 = 12 * 16 ^ -2 = 0.046875, so the final answer is 1.046874 * 2 ^ -116. While my book has similar examples that I tried to follow along with, none were exactly of this type, so I highly suspect I'm doing something wrong. Any tips, hints, or strategies would be greatly appreciated.

• Why the votes to close as "off-topic"? William Kahan was given the Turing award in 1989 specifically because of his work on developing IEEE-754, which is "a specification for a computing environment in which hardware, compilers and application programs would interact". It's hard to imagine something more on-topic than that. – Wandering Logic Oct 2 '15 at 1:48

A good start is to expand the hex representation into binary like how you did it.

0000 1100 0000 0000 0000 0000 0000 0000

Then parse the word:

• the left-most bit is the sign bit
• the next 8 bits represent the biased-exponent
• the last bits represent the fractional part with the "hidden one"

0 | 00011000 | 00000000000000000000000

Then, follow:

$(-1)^s&space;*&space;(1&space;+&space;Fraction)&space;*&space;2^{Exponent&space;-&space;Bias}$

• s represents the sign bit
• evaluate the binary representation of the exponent to decimal
• subtract the bias from the exponent (bias for single-precision is 127 and 1023 for double-precision)
• evaluate the normalized form to decimal and you have your floating point decimal number

I hope this helps. It took me a while to understand encoding and decoding using IEEE-754. Slow and steady wins the race.

• Thanks so much! So (-1) ^ 0 * (1 + 0) * 2 ^ (24 - 127) = 2 ^ -103 would be the correct single-precision floating point number? – user40496 Oct 2 '15 at 0:59
• Yeah, you'll eventually get the floating point number: expand 1.0 x 2 ^ -103 in binary then convert to decimal. Note the fraction part is (1 + .0), not (1 + 0). This would be a common pitfall. Hence you get 1.0 x 2 ^ -103 – Joseph R. Oct 2 '15 at 2:36
• @user40496 in your work, you used some of the bits twice. There's only one C in the whole thing, so "the exponent is 0C and the mantissa is 0C0000" couldn't possibly be right. :) – hobbs Oct 14 '15 at 5:22