title: How to handle very small numbers in c++?
body: <p>I am writing a program in C++ which includes very small floating point numbers. So, I have used <code>double</code> to represent the numbers. But as the floating point numbers are multiplied in a loop, it results in the final product being 0. But I need to display the actual floating point number. How can I handle such numbers?</p>
  
  <pre><code>class myclass
  {
  private :
      double value;
  }
  
  double calculate(count)
  {
      double  key=this-&gt;value;
      double prev_level=pow(2,level-1);
      if(key-prev_level &gt;=0)
          key=key-prev_level;
  
      int index= (2* key) + table[row_num][pos];
      double num1=array_l1[index]; // array_l1 and array_l2 are of type double
      double num2=array_l2[index];
  
      std::pair&lt;double,double&gt; p = list[key].at(row_num);
      double data=p.first;
      prod1=num1 *data;
  
      data=p.second;
      prod2=num2 * data;
  
      return prod1+prod2;
  }
  
  void compute()
  {
  
      double prod = 1;
      for (int i = 0; i &lt; count; i++)
      {
          myclass c1(count);
          myclass c2(count+1);
          double value= c1.calculate * c2.calculate();  
  
      }
  }
  </code></pre>
  
  <p>I am not able to include all the code because of the size, but I hope this function can explain the problem I am facing. As the value of <code>count</code> increases, the value of <code>value</code> decreases. So for larger value of <code>count</code>, I get a 0.</p>
  
  <p>How can I display the actual value of <code>value</code>?</p>