summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrennan D Baraban <34765317+bdbaraban@users.noreply.github.com>2019-09-11 13:59:37 (GMT)
committerJulien Palard <julien@palard.fr>2019-09-11 13:59:37 (GMT)
commit1660a61a105bcd62e2dfa77885959a8992e9f14e (patch)
tree11e2819d8dde290b864082f6e696ccb9f0ee47e6
parent1a53c785e62e00bad87ae19466c3a32ebcebb915 (diff)
downloadcpython-1660a61a105bcd62e2dfa77885959a8992e9f14e.zip
cpython-1660a61a105bcd62e2dfa77885959a8992e9f14e.tar.gz
cpython-1660a61a105bcd62e2dfa77885959a8992e9f14e.tar.bz2
bpo-23460: Fix documentation for decimal string :g formatting (GH-11850)
-rw-r--r--Doc/library/string.rst7
-rw-r--r--Misc/NEWS.d/next/Documentation/2019-02-14-07-12-48.bpo-23460.Iqiqtm.rst1
2 files changed, 5 insertions, 3 deletions
diff --git a/Doc/library/string.rst b/Doc/library/string.rst
index af8b9b3..af52af0 100644
--- a/Doc/library/string.rst
+++ b/Doc/library/string.rst
@@ -500,9 +500,10 @@ The available presentation types for floating point and decimal values are:
| | |
| | The precise rules are as follows: suppose that the |
| | result formatted with presentation type ``'e'`` and |
- | | precision ``p-1`` would have exponent ``exp``. Then |
- | | if ``-4 <= exp < p``, the number is formatted |
- | | with presentation type ``'f'`` and precision |
+ | | precision ``p-1`` would have exponent ``exp``. Then, |
+ | | if ``m <= exp < p``, where ``m`` is -4 for floats and -6 |
+ | | for :class:`Decimals <decimal.Decimal>`, the number is |
+ | | formatted with presentation type ``'f'`` and precision |
| | ``p-1-exp``. Otherwise, the number is formatted |
| | with presentation type ``'e'`` and precision ``p-1``. |
| | In both cases insignificant trailing zeros are removed |
diff --git a/Misc/NEWS.d/next/Documentation/2019-02-14-07-12-48.bpo-23460.Iqiqtm.rst b/Misc/NEWS.d/next/Documentation/2019-02-14-07-12-48.bpo-23460.Iqiqtm.rst
new file mode 100644
index 0000000..4674d55
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2019-02-14-07-12-48.bpo-23460.Iqiqtm.rst
@@ -0,0 +1 @@
+The documentation for decimal string formatting using the `:g` specifier has been updated to reflect the correct exponential notation cutoff point. Original patch contributed by Tuomas Suutari. \ No newline at end of file