title: Why would a c++ double be limiting itself to 5 decimal places?
body: <p>I'm hoping you can help with a bit of a head scratcher.</p>
  
  <p>I have written out a template class to calculate standard deviations:</p>
  
  <pre><code>template &lt;class T&gt;
  double GetStandardDeviation(T* valueArray, int populationSize)
  {
      double average;
      T cumulativeValue = 0;
      double cumulativeSquaredDeviation = 0;
      // calculate average
      for (int i = 0; i &lt; populationSize; i++)
      {
          cumulativeValue += valueArray[i];
      }
      average = (double)cumulativeValue / (double)populationSize;
      // calculate S.D.
      for (int i = 0; i &lt; populationSize; i++)
      {
          double difference = average - (double)valueArray[i];
          double squaredDifference = difference * difference;
          cumulativeSquaredDeviation += squaredDifference;
      }
      return cumulativeSquaredDeviation / (double)populationSize;
  
  }
  </code></pre>
  
  <p>And this seems to be doing everything correctly, except it returns the result to only 5 decimal places.  Can anyone suggest a reason for this?  I'm stumped!</p>