title: Convert scientific notation to decimal with no trailing zeros
body: <p>I would like to have floats printed out</p>
  
  <ul>
  <li>in decimal notation</li>
  <li>with no trailing zeros</li>
  </ul>
  
  <p>For instance:</p>
  
  <pre><code>1e-5    -&gt; 0.00001
  1.23e-4 -&gt; 0.000123
  1e-8    -&gt; 0.00000001
  </code></pre>
  
  <hr>
  
  <p>Some things that don't work:</p>
  
  <p><code>str(x)</code> outputs scientific notation for small floats</p>
  
  <p><code>format(x, 'f')</code> and <code>"{:f}".format(x)</code> have fixed number of decimals, thus leave trailing zeroes</p>
  
  <p><code>('%f' % x).rstrip('0').rstrip('.')</code> rounds <code>1e-8</code> to <code>0</code></p>
  
  <pre><code>from decimal import Decimal
  (Decimal('0.00000001000').normalize())
  </code></pre>
  
  <p>uses scientific notation</p>
  
  <p><code>%0.10f</code> requires that I know ahead of time the precision of my floats</p>