From a724de04c9f2110fb3c463cd45fd51df055248e7 Mon Sep 17 00:00:00 2001 From: Brad Wolfe Date: Tue, 22 Nov 2022 08:05:36 +0100 Subject: [PATCH 1/3] Change documentation for sys.float_info.rounds Change the documentation for sys.float_info.rounds to remove references to C99 section 5.2.4.2.2 and instead place the available values inline. --- Doc/library/sys.rst | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index d54ecd75a2628f..cf88c1e2ef4686 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -604,12 +604,17 @@ always available. +---------------------+----------------+--------------------------------------------------+ | :const:`radix` | FLT_RADIX | radix of exponent representation | +---------------------+----------------+--------------------------------------------------+ - | :const:`rounds` | FLT_ROUNDS | integer constant representing the rounding mode | - | | | used for arithmetic operations. This reflects | - | | | the value of the system FLT_ROUNDS macro at | - | | | interpreter startup time. See section 5.2.4.2.2 | - | | | of the C99 standard for an explanation of the | - | | | possible values and their meanings. | + | :const:`rounds` | FLT_ROUNDS | The rounding mode for floating-point addition is | + | | | characterized by the implementation defined value| + | | | of FLT_ROUNDS: | + | | | -1 indeterminable | + | | | 0 toward zero | + | | | 1 to nearest | + | | | 2 toward positive infinity | + | | | 3 toward negative infinity | + | | | | + | | | All other values for FLT_ROUNDS characterize | + | | | implementation-defined rounding behavior. | +---------------------+----------------+--------------------------------------------------+ The attribute :attr:`sys.float_info.dig` needs further explanation. If From 7031f9f1734995965af66e30c64b83772e675846 Mon Sep 17 00:00:00 2001 From: Brad Wolfe Date: Tue, 22 Nov 2022 08:38:09 +0100 Subject: [PATCH 2/3] Correction to previous documentation change Newlines were not preserved in generated HTML on previous commit. I have changes the list to a comma-separated list of values and their meanings. --- Doc/library/sys.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index cf88c1e2ef4686..6948cf2733c133 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -607,11 +607,11 @@ always available. | :const:`rounds` | FLT_ROUNDS | The rounding mode for floating-point addition is | | | | characterized by the implementation defined value| | | | of FLT_ROUNDS: | - | | | -1 indeterminable | - | | | 0 toward zero | - | | | 1 to nearest | - | | | 2 toward positive infinity | - | | | 3 toward negative infinity | + | | | ``-1`` indeterminable, | + | | | ``0`` toward zero, | + | | | ``1`` to nearest, | + | | | ``2`` toward positive infinity, | + | | | ``3`` toward negative infinity | | | | | | | | All other values for FLT_ROUNDS characterize | | | | implementation-defined rounding behavior. | From 4243533122b0891387fe837e05e606c9ed21bff9 Mon Sep 17 00:00:00 2001 From: Brad Wolfe Date: Tue, 22 Nov 2022 20:49:47 +0100 Subject: [PATCH 3/3] Clarify source for value of FLT_ROUNDS Clarify the source of the FLT_ROUNDS value and change 'floating-point addition' to 'floating-point arithmetic' to indicate that the rounding mode applies to all arithmetic operations. --- Doc/library/sys.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 6948cf2733c133..428ce51165c9b5 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -604,9 +604,10 @@ always available. +---------------------+----------------+--------------------------------------------------+ | :const:`radix` | FLT_RADIX | radix of exponent representation | +---------------------+----------------+--------------------------------------------------+ - | :const:`rounds` | FLT_ROUNDS | The rounding mode for floating-point addition is | - | | | characterized by the implementation defined value| - | | | of FLT_ROUNDS: | + | :const:`rounds` | FLT_ROUNDS | integer representing the rounding mode for | + | | | floating-point arithmetic. This reflects the | + | | | value of the system FLT_ROUNDS macro at | + | | | interpreter startup time: | | | | ``-1`` indeterminable, | | | | ``0`` toward zero, | | | | ``1`` to nearest, |