Jan. 21, 2020
1:32 a.m.
21.01.20 10:37, Eric V. Smith пише:
For what it's worth, float's repr internally uses a format of '.17g'. So, format(value, '.17g') will be equal to repr(f), where f is any float.
It was in Python 2, but since Python 3.1 it returns the shortest unambiguous representation, which may be shorter than 17 digits. https://docs.python.org/3/whatsnew/3.1.html#other-language-changes https://bugs.python.org/issue1580