title: sprintf formatting: fixed number of characters, variable numbers of decimals
body: <p>I am <a href="http://www.cplusplus.com/reference/cstdio/printf/" rel="nofollow noreferrer">looking</a> for a <code>sprintf</code>-like format string that would format float numbers with a <em>variable</em> number of decimals, but a <strong>fixed</strong> total number of characters (say, 3), in order to provide maximum information. For instance:</p>
  
  <pre><code>0      -&gt;  `.00` or `0.0` or `  0`
  0.124  -&gt;  `.12`
  0.357  -&gt;  `.36`
  1.788  -&gt;  `1.8`
  9.442  -&gt;  `9.4`
  10.25  -&gt;  `10.` or ` 10`
  75.86  -&gt;  `76.` or ` 76`
  99.44  -&gt;  `99.` or ` 99`
  100.0  -&gt;  `100`
  </code></pre>
  
  <p>(yes, my numbers will all be 0-to-100 floats)</p>
  
  <p>How to achieve this?<br>
  Is this kind of fixed-width formatting implemented in sprintf format string language?</p>