title: C++: How to Convert From Float to String Without Rounding, Truncation or Padding?
body: <p>I am facing a problem and unable to resolve it. Need help from gurus. Here is sample code:-</p>
  
  <pre><code>float f=0.01f;
  printf("%f",f);
  </code></pre>
  
  <p>if we check value in variable during debugging f contains '0.0099999998' value and output of printf is 0.010000. </p>
  
  <p>a.   Is there any way that we may force the compiler to assign same values to variable of float type?</p>
  
  <p>b.   I want to convert float to string/character array. How is it possible that only and only exactly same value be converted to string/character array. I want to make sure that no zeros are padded, no unwanted values are padded, no changes in digits as in above example.</p>