title: Calculating e^x without using any functions
body: <p>We are supposed to calculate e^x using this kind of formula:</p>
  
  <p>e^x = 1 + (x ^ 1 / 1!) + (x ^ 2 / 2!) ......</p>
  
  <p>I have this code so far:</p>
  
  <pre><code>while (result &gt;= 1.0E-20 )
  {
      power = power * input;
      factorial = factorial * counter;
      result = power / factorial;
      eValue += result;
      counter++;
      iterations++;
  }
  </code></pre>
  
  <p>My problem now is that since factorial is of type long long, I can't really store a number greater than 20! so what happens is that the program outputs funny numbers when it reaches that point .. </p>
  
  <p>The correct solution can have an X value of at most 709 so e^709 should output: 8.21840746155e+307</p>
  
  <p>The program is written in C++.</p>