#1,090 – Using Visual Studio to Verify How Floating Point Numbers Are Stored
May 6, 2014 1 Comment
Recall that floating point numbers are stored in memory by storing the sign bit, exponent and mantissa.
We showed that the decimal value of 7.25, stored as a 32-bit floating point value, is stored as the binary value 0x40E80000.
We can verify this in Visual Studio by assigning a float to contain the value 7.25 and then looking at that value in memory.
Notice that the bytes appear to be backwards, relative to their order as written above. This is because Intel is a little-endian platform (bytes at “little” end of 32-bit word are stored first).