title: Unexpected rounding of double types in C++ writing to file
body: <p>I am working on a C++ program with a lot of numbers that are type double (values in the millions and billions with just a couple places to the right of the decimal point).  I am performing calculations on these numbers and then printing the result to text/CSV files.  I noticed that in the text files, all of my numbers appear to be rounded (to six digits).  So, a value of 13,169,911 is showing up as 13,169,900 in my output file.  </p>
  
  <p>Is this rounding only occuring on the print?  In order to get the full number of digits in the variable, do I just need to specify something when I write to a file?  I included a sample of my write to file code below:</p>
  
  <pre><code>void PrintPropFinance(vector&lt;PropFinance&gt;&amp; PF, int NumProps, int Iterations, int ForecastLength, 
            string CurDeal, string ModelRunID, string ScenName, Assumptions&amp; Ass) {
  
  string filename;
  ofstream OutFile;
  ostringstream s1;
  
  s1 &lt;&lt; BASEPATH &lt;&lt; "Output/" &lt;&lt; CurDeal &lt;&lt; "_" &lt;&lt; ModelRunID &lt;&lt; "_" &lt;&lt; 
              ScenName &lt;&lt; "_PropFinance" &lt;&lt; ".csv";
  filename = s1.str();
  
  OutFile.open(filename);
  
  // Put in the column headers first
  OutFile &lt;&lt; "PropID" &lt;&lt; "," 
          &lt;&lt; "Item" &lt;&lt; ","
          &lt;&lt; "StartDate" &lt;&lt; ","
          &lt;&lt; "NumOfPeriod" &lt;&lt; ","
          &lt;&lt; "Result" &lt;&lt; ","
          &lt;&lt; "Isap" &lt;&lt; ","
          &lt;&lt; "CurLoanBal" &lt;&lt; ","
  
  for (int i=1; i&lt;=NumProps; ++i) {
      // Populate the single-vector variables
      OutFile &lt;&lt; PF[i].PropID &lt;&lt; "," 
              &lt;&lt; PF[i].Item &lt;&lt; ","
              &lt;&lt; PF[i].StartDate &lt;&lt; ","
              &lt;&lt; PF[i].NumOfPeriod &lt;&lt; ","
              &lt;&lt; PF[i].Result &lt;&lt; ","
              &lt;&lt; PF[i].Isap &lt;&lt; ","
              &lt;&lt; PF[i].CurLoanBal &lt;&lt; ","
                                      &lt;&lt; endl;
  }
  OutFile.close();
  }
  
  // Prop finance class definition
  class PropFinance {
  public:
      string PropID;
      int Item;
      string StartDate;
  
      int NumOfPeriod;
      string Isap;
      double CurLoanBal;
  }
  </code></pre>