]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-123560: Correct docs for "empty" format type for floats (GH-123561) (#124596)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 26 Sep 2024 20:52:18 +0000 (22:52 +0200)
committerGitHub <noreply@github.com>
Thu, 26 Sep 2024 20:52:18 +0000 (13:52 -0700)
gh-123560: Correct docs for "empty" format type for floats (GH-123561)
(cherry picked from commit 274d9ab619b8150a613275835234ea9ef935f21f)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Doc/library/string.rst

index 1f316307965c113475cbcba8b97b8467ee28c6bb..57a1f920523035377b7b237d1995ffde756d9bf6 100644 (file)
@@ -574,11 +574,13 @@ The available presentation types for :class:`float` and
    | ``'%'`` | Percentage. Multiplies the number by 100 and displays    |
    |         | in fixed (``'f'``) format, followed by a percent sign.   |
    +---------+----------------------------------------------------------+
-   | None    | For :class:`float` this is the same as ``'g'``, except   |
+   | None    | For :class:`float` this is like the ``'g'`` type, except |
    |         | that when fixed-point notation is used to format the     |
    |         | result, it always includes at least one digit past the   |
-   |         | decimal point. The precision used is as large as needed  |
-   |         | to represent the given value faithfully.                 |
+   |         | decimal point, and switches to the scientific notation   |
+   |         | when ``exp >= p - 1``.  When the precision is not        |
+   |         | specified, the latter will be as large as needed to      |
+   |         | represent the given value faithfully.                    |
    |         |                                                          |
    |         | For :class:`~decimal.Decimal`, this is the same as       |
    |         | either ``'g'`` or ``'G'`` depending on the value of      |