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