title: How do I use bitwise operators on a "double" on C++?
body: <p>I was asked to get the internal binary representation of different types in C. My program currently works fine with 'int' but I would like to use it with "double" and "float". My code looks like this:</p>
  
  <pre><code>template &lt;typename T&gt;
  string findBin(T x) {
  string binary;
  for(int i = 4096 ; i &gt;= 1; i/=2) {
          if((x &amp; i) != 0) binary += "1";
          else binary += "0";
  }
      return binary;
  }
  </code></pre>
  
  <p>The program fails when I try to instantiate the template using a "double" or a "float".</p>