https://github.com/python/cpython/commit/090c0f140398fa923ac893936a95246d82d53e66 commit: 090c0f140398fa923ac893936a95246d82d53e66 branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: ZeroIntensity <[email protected]> date: 2025-11-05T22:05:47Z summary:
[3.14] gh-141004: Document `Py_RETURN_NAN` and `Py_RETURN_INF` (GH-141029) (GH-141074) gh-141004: Document `Py_RETURN_NAN` and `Py_RETURN_INF` (GH-141029) (cherry picked from commit 5b02c6e920aaef4b202fc19186f742d008460fd3) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Sergey B Kirpichev <[email protected]> files: M Doc/c-api/float.rst diff --git a/Doc/c-api/float.rst b/Doc/c-api/float.rst index 489676caa3a16a..1085c32a537071 100644 --- a/Doc/c-api/float.rst +++ b/Doc/c-api/float.rst @@ -78,6 +78,23 @@ Floating-Point Objects Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`. +.. c:macro:: Py_RETURN_NAN + + Return :data:`math.nan` from a function. + + On most platforms, this is equivalent to ``return PyFloat_FromDouble(NAN)``. + + +.. c:macro:: Py_RETURN_INF(sign) + + Return :data:`math.inf` or :data:`-math.inf <math.inf>` from a function, + depending on the sign of *sign*. + + On most platforms, this is equivalent to the following:: + + return PyFloat_FromDouble(copysign(INFINITY, sign)); + + Pack and Unpack functions ------------------------- _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
