title: Machine epsilon estimation in C
body: <p>I'm new to C and I'm trying to find machine epsilon (1.0 + macheps > 1.0), eta (eta > 0.0) and MAX (MAX &lt; infinity), but my code doesn't work as intended. First of all, macheps is calculated using 80-bit precision. How do I force it to single, double and long double? Secondly, the code doesn't finish calculating the results for double precision at all.</p>
  
  <p>EDIT: Fixed the format error.</p>
  
  <pre><code>/* macheps eta max */
  
  #include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  #include &lt;float.h&gt;
  #define TYPE long double
  
  int main(void)
  {
      TYPE macheps = (TYPE) 1.0;
      TYPE eta = (TYPE) 1.0;
      TYPE maksymilian = (TYPE) 2.0;
      TYPE real_macheps;
      TYPE real_eta;
      TYPE real_maksymilian;
  
      TYPE something = (TYPE) 1.0 + (TYPE) macheps;
  
      while ((TYPE) something &gt; (TYPE) 1.0)
      {
          real_macheps = (TYPE) macheps;
          printf("%e ", (TYPE) real_macheps);
          macheps = (TYPE) macheps/(TYPE) 2.0;
          something = (TYPE) 1.0 + (TYPE) macheps;
      }
      printf("%e\n", (TYPE) real_macheps);
  
      while ((TYPE) eta &gt; (TYPE) 0.0)
      {
          real_eta = (TYPE) eta;
          eta = (TYPE) eta/(TYPE) 2.0;
      }
      printf("%e\n", (TYPE) real_eta);
  
      while ((TYPE) maksymilian != INFINITY)
      {
          (real_maksymilian) = (TYPE) maksymilian;
          maksymilian = (TYPE) maksymilian*(TYPE) 2.0;
      }
      real_maksymilian = (TYPE) real_maksymilian * (TYPE) (2.0-(TYPE) real_macheps);
      printf("%e\n", (TYPE) real_maksymilian);
  }
  </code></pre>
  
  <p>EDIT2: Shouldn't the above code force precision? What am I missing?</p>
  
  <p>EDIT3: Still doesn't give correct macheps for long double.</p>