From 957962136da6a51a687c5fcffbfa14b832f03a93 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sun, 1 Sep 2024 11:22:54 +0300 Subject: [PATCH 1/2] gh-123560: correct docs for "empty" format type for floats --- Doc/library/string.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 1f316307965c11..10fbd55bb34f5b 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -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, thus switch to the scientific notation | + | | happens when ``exp >= p - 1``. If precision is not | + | | specified, the precision used is 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 | From dfb592da71e5f3abe6e87edcd02565b36984e05d Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Wed, 25 Sep 2024 18:01:26 +0300 Subject: [PATCH 2/2] address review: reword --- Doc/library/string.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 10fbd55bb34f5b..57a1f920523035 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -577,9 +577,9 @@ The available presentation types for :class:`float` and | 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, thus switch to the scientific notation | - | | happens when ``exp >= p - 1``. If precision is not | - | | specified, the precision used is as large as needed to | + | | 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 |