Skip to content

Commit 5b02c6e

Browse files
gh-141004: Document Py_RETURN_NAN and Py_RETURN_INF (GH-141029)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
1 parent 11fc411 commit 5b02c6e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Doc/c-api/float.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,23 @@ Floating-Point Objects
7878
Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`.
7979
8080
81+
.. c:macro:: Py_RETURN_NAN
82+
83+
Return :data:`math.nan` from a function.
84+
85+
On most platforms, this is equivalent to ``return PyFloat_FromDouble(NAN)``.
86+
87+
88+
.. c:macro:: Py_RETURN_INF(sign)
89+
90+
Return :data:`math.inf` or :data:`-math.inf <math.inf>` from a function,
91+
depending on the sign of *sign*.
92+
93+
On most platforms, this is equivalent to the following::
94+
95+
return PyFloat_FromDouble(copysign(INFINITY, sign));
96+
97+
8198
Pack and Unpack functions
8299
-------------------------
83100

0 commit comments

Comments
 (0)