Skip to content

Commit 4907f37

Browse files
miss-islingtonZeroIntensityskirpichev
authored
[3.13] pythongh-141004: Document Py_RETURN_NAN and Py_RETURN_INF (pythonGH-141029) (pythonGH-141075)
pythongh-141004: Document `Py_RETURN_NAN` and `Py_RETURN_INF` (pythonGH-141029) (cherry picked from commit 5b02c6e) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Sergey B Kirpichev <[email protected]>
1 parent db0900b commit 4907f37

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)