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 terry.reedy
Recipients Barium, docs@python, eric.smith, mark.dickinson, terry.reedy
Date 2014-10-03.20:23:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
"The precision is a decimal number indicating how many digits should be displayed ... before and after the decimal point for a floating point value formatted with 'g' or 'G'. It seems that str, repr, and '' are using precision 16, and the doc should be changed to match.

'0.3141592653589793' # 16, not counting 0.

>>> '{}'.format(3.14159265358979323846264338327950288419)
>>> '{:.16g}'.format(3.14159265358979323846264338327950288419)
>>> str(3.14159265358979323846264338327950288419)
'3.141592653589793'  # 16

But I discovered this 'anomaly' (bug?)
>>> str(31.4159265358979323846264338327950288419)
>>> str(33.14159265358979323846264338327950288419)
'33.1415926535898'  # precision 15
I expected this last to be
as 32... rounds down, not up.

repr and '{}'.format act the same.
Date User Action Args
2014-10-03 20:23:18terry.reedysetrecipients: + terry.reedy, mark.dickinson, eric.smith, docs@python, Barium
2014-10-03 20:23:18terry.reedysetmessageid: <>
2014-10-03 20:23:18terry.reedylinkissue22546 messages
2014-10-03 20:23:17terry.reedycreate