title: Writing numbers to a file with more precision - C++
body: <p>I wrote some parameters (all of type <code>double</code>) to a file for use in performing some complex computations. I write the parameters to the files like so:  </p>
  
  <p><code>refStatsOut &lt;&lt; "SomeParam:" &lt;&lt; value_of_type_double &lt;&lt; endl;</code><br>
  where <code>refStatsOut</code> is an <code>ofstream</code>parameter. There are four such parameters, each of type <code>double</code>. What I see as written to the file is different from what its actual value is (in terms of loss of precision). As an example, if <code>value_of_type_double</code> had a value -28.07270379934792, then what I see as written in the file is -28.0727.   </p>
  
  <p>Also, once these stats have been computed and written I run different programs that use these statistics. The files are read and the values are initially stored as <code>std::strings</code> and then converted to <code>double</code> via <code>atof</code> functions. This results in the values that I have shown above and ruins the computations further down.  </p>
  
  <p>My question is this:<br>
  1. Is there a way to increase the resolution with which one can write values (of type <code>double</code> and the like) to a file so as to NOT lose any precision?<br>
  2. Could this also be a problem of <code>std::string</code> to <code>double</code> conversion with <code>atof</code>? If so, what other function could I use to solve this?  </p>
  
  <p>P.S: Please let me know in case some of the details in this question are not clear. I will try to update them and provide more details.</p>