# #1,095 – How Floating Point Infinity Values Are Stored

May 13, 2014 1 Comment

.NET floating point types can represent both positive and negative infinity floating point values. They are stored as 32-bit floating point values as follows:

- +Infinity : sign bit 0, mantissa 0 (23 bits), exponent FF (hex) (8 bits)
- -Infinity : sign bit 1, mantissa 0 (23 bits), exponent FF (hex) (8 bits)

Positive infinity is therefore stored as 7F800000 (hex) and negative zero as FF800000 (hex). We can verify this by looking at these values in memory from within Visual Studio.

Assuming the following code:

float posInfinity = float.PositiveInfinity; float negInfinity = float.NegativeInfinity;

We can now look at these values in memory.

Positive infinity is 7F800000 (stored little-endian).

Negative infinity is FF800000 (stored little-endian).

Pingback: Dew Drop – May 13, 2014 (#1775) | Morning Dew