title: Conversion from float to double in c++
body: <p>I wrote a code to calculate error function or <code>double erf(double x)</code>.  It uses lots of constants in calculations which uses double as well. However, the requirement is to write a code <code>float</code> format or <code>float erf(float)</code>.  I have to maintain 6 decimals accuracy (typically for <code>float</code>).</p>
  
  <p>When I converted <code>erf(x)</code> into <code>float erf( double x)</code>, the results are still the same and accurate.  However when I convert <code>x</code> to <code>float</code> or <code>float erf(float x)</code> I am getting some significant errors in small values of <code>x</code>.  </p>
  
  <p>Is there a way to convert <code>float</code> to <code>double</code> for <code>x</code> so that precision is still maintained within the code of <code>erf(x)</code>?  My intuition tells me that my <code>erf</code> code is good only for double value numbers.</p>