Mark Dickinson added the comment:

> It seems that str, repr, and '' are using precision 16

None of them is using a fixed precision: they're all using David Gay's 
implementation of the "shortest string" algorithm (à la Burger and Dybvig).   
For repr, this is the case since Python 3.1 / 2.7; for str and formatting with 
no type specifier, since Python 3.2.  The docs definitely do need updating here.

> I expected this last to be
> '33.14159265358979'

'33.1415926535898' is shorter, and rounds back to the same floating-point 
number, so that's what Gay's algorithm gives here.

----------

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

Reply via email to