## #1,088 – How 32-Bit Floating Point Numbers Are Stored in .NET, part I

May 2, 2014 Leave a comment

Floating point numbers in .NET (on Intel-based PCs) are stored using the IEEE 754 standard, which defines how to store both 32-bit (**float**) and 64-bit (**double**) floating points.

Floating point numbers are stored in memory by storing the value as a binary floating point value represented using scientific notation (binary).

For example, to store a decimal value of 7.25:

The exponent is expressed as binary, so it has a value of 2.

We can now store this floating point number in memory by storing three things:

- The sign of the number (positive)
- The mantissa (1.1101)
- The exponent (10)

On Intel-based PCs, 32-bit floating point numbers are stored as follows:

- 1 bit to store the sign (0 for positive numbers, 1 for negative numbers)
- 8 bits to store the exponent
- 23 bits to store the mantissa

*More coming in part II*