summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-10-11 21:07:41 (GMT)
committerGitHub <noreply@github.com>2021-10-11 21:07:41 (GMT)
commita9fe1a8e5b4698937e06c2c419da92e6f78f2ee7 (patch)
treef723bed2759c2475754e0acf89a7ba542531b263
parent1ebd798fddef51e1f6fd40a4860278a1851ac268 (diff)
downloadcpython-a9fe1a8e5b4698937e06c2c419da92e6f78f2ee7.zip
cpython-a9fe1a8e5b4698937e06c2c419da92e6f78f2ee7.tar.gz
cpython-a9fe1a8e5b4698937e06c2c419da92e6f78f2ee7.tar.bz2
bpo-45412: Update _Py_ADJUST_ERANGE1() comment (GH-28884)
Copy the comment from the removed Py_OVERFLOWED() function.
-rw-r--r--Include/internal/pycore_pymath.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/Include/internal/pycore_pymath.h b/Include/internal/pycore_pymath.h
index c299c64..e4d5778 100644
--- a/Include/internal/pycore_pymath.h
+++ b/Include/internal/pycore_pymath.h
@@ -19,8 +19,15 @@ extern "C" {
* effect, we're trying to force a useful implementation of C89 errno
* behavior.
* Caution:
- * This isn't reliable. See Py_OVERFLOWED comments.
- * X and Y may be evaluated more than once.
+ * This isn't reliable. C99 no longer requires libm to set errno under
+ * any exceptional condition, but does require +- HUGE_VAL return
+ * values on overflow. A 754 box *probably* maps HUGE_VAL to a
+ * double infinity, and we're cool if that's so, unless the input
+ * was an infinity and an infinity is the expected result. A C89
+ * system sets errno to ERANGE, so we check for that too. We're
+ * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or
+ * if the returned result is a NaN, or if a C89 box returns HUGE_VAL
+ * in non-overflow cases.
*/
static inline void _Py_ADJUST_ERANGE1(double x)
{