title: How to print hexadecimal double in C?
body: <p>I have this number in hexadecimal:</p>
  
  <blockquote>
    <p>FFFFFFFFFFFF</p>
  </blockquote>
  
  <p>and I need to save it, so I used double</p>
  
  <pre><code>double a=0xffffffffffff;
  </code></pre>
  
  <p>but I need to print it and I don't know how to. Each time I use <code>%f</code>, <code>%d</code>, <code>%x</code>, it doesn't print the value of it; I just need to print <code>ffffffffffff</code>.   My code:</p>
  
  <pre><code>int main()
  {
      double a=0xffffffffffff;
      printf("%x\n",a);
      printf("%d\n",a);
      printf("%X\n",a);
      printf("%f\n",a);
      return 0;
  }
  </code></pre>
  
  <p>The only true value is <code>%f</code>; that returns the decimal value of the hexadecimal — it returns this:</p>
  
  <pre><code> ffffffe0
   -32 
   FFFFFFE0
   281474976710655.000000
  </code></pre>
  
  <p>with this I need to change from that hexadecimal to string, to compare it, because I have FFFFFFFFFFFF in string too and I need to compare both. If I can't <code>printf</code> it, neither will <code>sprintf</code> will work.</p>