title: Format Specifier for long double in c
body: <p>I'm using <strong>Windows 8.1 64 bit</strong>.</p>
  
  <p>IDE: <strong>Eclipse Luna(4.4.0)</strong>.</p>
  
  <p>and using <strong>MinGW v4.9.1</strong></p>
  
  <p>I typed this program in eclipse but it is showing showing zeroes in long double. i tried both %llf and %Lf and also tried type casting but nothing worked for me.</p>
  
  <pre><code>1.   int main(void) {  
  2.   float floatNumber;
  3.   double doubleNumber;
  4.   long double longDoubleNumber;
  5.
  6.   // Size of floating point types
  7.   printf("Storage size for unsigned float : %lu  bytes \n", sizeof(float));
  8.   printf("Storage size for double :         %lu  bytes \n", sizeof(double));
  9.   printf("Storage size for long double :   %lu  bytes \n", sizeof(long double));
  10.
  11.  floatNumber = 2.0/3.0;
  12.  doubleNumber = 2.0/3.0;
  13.  longDoubleNumber = 2.0/3.0;
  14.
  15.  puts("\nCompare precision at 4 decimal points:");
  16.  printf("floatNumber      = %1.4f\n", floatNumber);
  17.  printf("doubleNumber     = %1.4lf\n", doubleNumber);
  18.  printf("longDoubleNumber = %1.4Lf\n", longDoubleNumber);
  19.
  20.  puts("\nCompare precision at 10 decimal points:");
  21.  printf("floatNumber      = %1.10f\n", floatNumber);
  22.  printf("doubleNumber     = %1.10lf\n", doubleNumber);
  23.  printf("longDoubleNumber = %1.10Lf\n", longDoubleNumber);
  24.
  25.  puts("\nCompare precision at 30 decimal points:");
  26.  printf("floatNumber      = %1.30f\n", floatNumber);
  27.  printf("doubleNumber     = %1.50lf\n", doubleNumber);
  28.  printf("longDoubleNumber = %1.50Lf\n", longDoubleNumber);
  29.  return 0;
  30.  }
  </code></pre>
  
  <p>
  here's the output:-</p>
  
  <pre><code>Floating point type usage in C:
  Storage size for unsigned float : 4  bytes 
  Storage size for double :         8  bytes 
  Storage size for long double :   16  bytes 
  
  Compare precision at 4 decimal points:
  floatNumber      = 0.6667
  doubleNumber     = 0.6667
  longDoubleNumber = 0.0000
  
  Compare precision at 10 decimal points:
  floatNumber      = 0.6666666865
  doubleNumber     = 0.6666666667
  longDoubleNumber = 0.0000000000
  
  Compare precision at 30 decimal points:
  floatNumber      = 0.666666686534881590000000000000
  doubleNumber     = 0.66666666666666663000000000000000000000000000000000
  longDoubleNumber = 0.00000000000000000000000000000000000000000000000000
  </code></pre>
  
  <p>And when i tried this:</p>
  
  <pre><code>printf("Storage size for unsigned float : %zu  bytes \n", sizeof floatNumber);
  printf("Storage size for double :         %zu  bytes \n", sizeof doubleNumber);
  printf("Storage size for long double :   %zu  bytes \n", sizeof longDoubleNumber);
  </code></pre>
  
  <p>the output is:</p>
  
  <pre><code>Floating point type usage in C:
  Storage size for unsigned float : zu  bytes 
  Storage size for double :         zu  bytes 
  Storage size for long double :   zu  bytes 
  </code></pre>
  
  <p>everything else is same as above.</p>
  
  <p>The List of Warnings shown by Eclipse are:-</p>
  
  <pre><code>line 7,8,9,18,23,28:- too many arguments for format [-Wformat-extra-args]
  line 18,23,28:- unknown conversion type character 'L' in format [-Wformat=]
  line 7,8,9:- format '%lu' expects argument of type 'long unsigned int', but argument
               2 has type 'long long unsigned int' [-Wformat=]
  
  {if i use %zu instead of %lu}
  line 7,8,9:- unknown conversion type character 'z' in format [-Wformat=]
  </code></pre>
  
  <p>What is the format specifier for long double?</p>