Skip to content

Commit 86b35f1

Browse files
committed
Document the expansion of the macros.
1 parent 2679d35 commit 86b35f1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Doc/c-api/float.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,23 @@ Floating-Point Objects
8282
8383
Return :data:`math.nan` from a function.
8484
85+
On most platforms, this is equivalent to ``return PyFloat_FromDouble(NAN)``.
86+
8587
8688
.. c:macro:: Py_RETURN_INF(sign)
8789
8890
Return :data:`math.inf` or :data:`-math.inf <math.inf>` from a function,
8991
depending on the sign of *sign*.
9092
93+
On most platforms, this is equivalent to the following::
94+
95+
if (copysign(1., sign) == 1.) {
96+
return PyFloat_FromDouble(INFINITY);
97+
}
98+
else {
99+
return PyFloat_FromDouble(-INFINITY);
100+
}
101+
91102
92103
Pack and Unpack functions
93104
-------------------------

0 commit comments

Comments
 (0)