Wolfgang Maier added the comment:

actually, I'm not sure whether formatting Decimals gives correct output under 
all conditions (correctly rounded yes, but maybe not formatted correctly?).

compare:

>>> format(float('1.481e-6'),'.3g')
'1.48e-06'

>>> format(Decimal('1.481e-6'),'.3g')
'0.00000148'

>>> format(float('1.481e-7'),'.3g')
'1.48e-07'

>>> format(Decimal('1.481e-7'),'.3g')
'1.48e-7'

So with the 'g' specifier the switch between floating point and scientific 
notation seems to be broken.
Also note the slightly different formatting of the exponent: the leading zero 
is missing for all specifiers, i.e. 'g', 'G', 'e', 'E'.

Are these bugs ?

----------
nosy: +wolma

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23602>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to