Message239336
| 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 ? |
|