This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author wolma
Recipients eric.smith, ezio.melotti, mark.dickinson, martin.panter, rhettinger, scoder, serhiy.storchaka, skrah, tuomas.suutari, wolma
Date 2015-03-26.15:09:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1427382550.36.0.00707014467092.issue23602@psf.upfronthosting.co.za>
In-reply-to
Content
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 ?
History
Date User Action Args
2015-03-26 15:09:10wolmasetrecipients: + wolma, rhettinger, mark.dickinson, scoder, eric.smith, ezio.melotti, skrah, martin.panter, serhiy.storchaka, tuomas.suutari
2015-03-26 15:09:10wolmasetmessageid: <1427382550.36.0.00707014467092.issue23602@psf.upfronthosting.co.za>
2015-03-26 15:09:10wolmalinkissue23602 messages
2015-03-26 15:09:09wolmacreate