Message147940
The documentation for string format options state that both %f, %g and %e default to 6 digits after the decimal point. In fact, %g always seems to use 5 digits by default:
>>> "%g" % 2.1234567
'2.12346'
>>> "%f" % 2.1234567
'2.123457'
>>> "%e" % 2.1234567
'2.123457e+00'
But something much more insidious is wrong, because even when explicitly told how many digits to have, %g is one off:
>>> "%.6g" % 2.1234567
'2.12346'
>>> "%.6f" % 2.1234567
'2.123457'
>>> "%.6e" % 2.1234567
'2.123457e+00'
This can't be right? |
|
Date |
User |
Action |
Args |
2011-11-19 13:01:32 | Christian.Iversen | set | recipients:
+ Christian.Iversen, docs@python |
2011-11-19 13:01:32 | Christian.Iversen | set | messageid: <1321707692.58.0.601543510069.issue13433@psf.upfronthosting.co.za> |
2011-11-19 13:01:31 | Christian.Iversen | link | issue13433 messages |
2011-11-19 13:01:31 | Christian.Iversen | create | |
|