How are NaN and Infinity of a float or double stored in memory?
<p>As I understand it java will store a float in memory as a 32 bit integer with the following properties:</p>

<ul>
<li>The first bit is used to determine the sign</li>
<li>The next 8 bits represent the exponent</li>
<li>The final 23 bits are used to store the fraction</li>
</ul>

<p>This leaves no spare bits for the three special cases:</p>

<ul>
<li>NaN</li>
<li>Positive Infinity</li>
<li>Negative Infinity</li>
</ul>

<p>I can guess that negative 0 could be used to store one of these.</p>

<p>How are these actually represented in memory?</p>