Binary representation of a double
<p>I was bored and wanted to see what the binary representation of double's looked like. However, I noticed something weird on windows. The following lines of codes demonstrate</p>

<pre><code>double number = 1;
unsigned long num = *(unsigned long *) &amp;number;
cout &lt;&lt; num &lt;&lt; endl;
</code></pre>

<p>On my Macbook, this gives me a nonzero number. On my Windows machine it gives me 0.</p>

<p>I was expecting that it would give me a non zero number, since the binary representation of 1.0 as a double should not be all zeros. However, I am not really sure if what I am trying to do is well defined behavior.</p>

<p>My question is, is the code above just stupid and wrong? And, is there a way I can print out the binary representation of a double?</p>

<p>Thanks.</p>
