# How to calculate floating point numbers?

Here are two locations in memory:

 0110 | 1111 1110 1101 0011
0111 | 0000 0110 1101 1001


Interpret locations 6 (0110) and 7 (0111) as an IEEE floating point number. Location 6 contains bits [15:0] and location 7 contains bits [16:31].

Floating Point -
Locations 6 and 7: 0000 0110 1101 1001 1111 1110 1101 0011
The number represented is 1.101 1001 1111 1110 1101 0011 × 2^(-114)


I am unsure exactly what the [16:31] and [15:0] relate to/mean?

• Not really a math question. You may have better luck on a computing site. – Gerry Myerson Sep 14 '14 at 7:25
• @GerryMyerson Can't we migrate this for him? It's been done for at least one my questions and maybe one of yours. – Robert Soupe Sep 14 '14 at 17:12
• @Robert, I suppose we could vote to close and migrate, or flag for moderator attention and suggest migration, but I don't know enough about computing sites to suggest one as the target. – Gerry Myerson Sep 15 '14 at 1:32
• @Gerry, I was looking at programmers.stackexchange, but a question there about converting from single precision float to half precision was closed for being "off-topic" (which of course does not always mean it really is off-topic. The scope is said to include questions about "algorithm and data structure concepts." – Robert Soupe Sep 15 '14 at 2:34
• @Robert, if you find an appropriate site, go ahead and take whatever steps you can to migrate. I'm happy to let OP do the work of finding a better site and the work of contacting the moderators to migrate, or let OP delete here and post elsewhere. – Gerry Myerson Sep 15 '14 at 3:53

The [16:31] and [15:0] refer to locations in the binary representation of a $32$-bit integer. You have interpreted this correctly.

When in doubt about technical problems, always consult Wikipedia an expert. In your case the number is 0 || 00001101 || 101 1001 1111 1110 1101 0011

The sign is positive.

The biased exponent is 1101 $= 13$, so the actual exponent is $13 - 127 = -114$, assuming single precision.

So the answer you have is correct: $$2^{-114} \times (1.101 1001 1111 1110 1101 0011)_2$$

• If this question didn't advocate trusting Wikipedia at any level on any topic, and if I was the issuer of the bounty, I think I would award it to this answer. – Robert Soupe Sep 17 '14 at 0:49
• I'd let the typo slide, though ("techincal"). – Robert Soupe Sep 17 '14 at 1:35
• Hows that? Better? – A.E Sep 17 '14 at 2:38
• Endianness do matter. You can check here – user137035 Sep 17 '14 at 10:22
• Agreed, endianness matters. I am assuming that the bits in memory correspond to a 32 bit word (in the order stated) and that the exponent and mantissa have the MSB on the left. – A.E Sep 17 '14 at 18:24