title: Printf width specifier to maintain precision of floating-point value
body: <p>Is there a <code>printf</code> width specifier which can be applied to a floating point specifier that would automatically format the output to the necessary number of <em>significant digits</em> such that when scanning the string back in, the original floating point value is acquired?</p>
  
  <p>For example, suppose I print a <code>float</code> to a precision of <code>2</code> decimal places:</p>
  
  <pre><code>float foobar = 0.9375;
  printf("%.2f", foobar);    // prints out 0.94
  </code></pre>
  
  <p>When I scan the output <code>0.94</code>, I have no standards-compliant guarantee that I'll get the original <code>0.9375</code> floating-point value back (in this example, I probably won't).</p>
  
  <p>I would like a way tell <code>printf</code> to automatically print the floating-point value to the necessary number of <em>significant digits</em> to ensure that it can be scanned back to the original value passed to <code>printf</code>.</p>
  
  <p>I could use some of the macros in <code>float.h</code> to <a href="https://stackoverflow.com/a/1701272/1806289">derive the maximum width</a> to pass to <code>printf</code>, but is there already a specifier to automatically print to the necessary number of <em>significant digits</em> -- or at least to the maximum width?</p>