title: Separate a double into it's sign, exponent and mantissa
body: <p>I've read a few topics that do already broken down doubles and "puts it together" but I am trying to break it into it's base components. So far I have the bit nailed down:</p>
  
  <pre><code>breakDouble( double d ){
  
      long L = *(long*) &amp;d;
  
      sign;
      long mask = 0x8000000000000000L;
  
      if( (L &amp; mask) == mask ){
  
          sign = 1;
  
      } else {
  
          fps.sign = 0;
      }
      ...
  }
  </code></pre>
  
  <p>But I'm pretty stumped as to how to get the exponent and the mantissa. I got away with forcing the double into a long because only the leading bit mattered so truncation didn't play a role. However, with the other parts I don't think that will work and I know you can't do bitwise operators on floats so I'm stuck.</p>
  
  <p>Thoughts?</p>
  
  <hr>
  
  <p><strong>edit: of course as soon as I post this I find <a href="https://stackoverflow.com/questions/15685181/how-to-get-the-sign-mantissa-and-exponent-of-a-floating-point-number">this, but I'm not sure how different floats and doubles are in this case.</a></strong></p>
  
  <hr>
  
  <p><strong>Edit 2(sorry working as I go):</strong> I read that post I linked in edit 1 and it seems to me that I can perform the operations they are doing on my double the same way, with masks for the exponent being:</p>
  
  <pre><code>mask = 0x7FF0000000000000L;
  </code></pre>
  
  <p>and  for the mantissa:</p>
  
  <pre><code>mask = 0xFFFFFFFFFFFFFL;
  </code></pre>
  
  <p>Is this correct?</p>