[issue46640] Python can now use the C99 NAN constant

STINNER Victor report at bugs.python.org
Sat Feb 5 11:42:34 EST 2022


STINNER Victor <vstinner at python.org> added the comment:

> The big blocker here is that a platform that fully supports C99 might not define the "NAN" macro. I don't think we can require that NAN be defined in order for Python to build (which is what the PR currently does, if I'm understanding it correctly).

If a platform doesn't implement NaN, it should define the Py_NO_NAN macro:

/* Py_NAN
 * A value that evaluates to a NaN. On IEEE 754 platforms INF*0 or
 * INF/INF works. Define Py_NO_NAN in pyconfig.h if your platform
 * doesn't support NaNs.
 */
#if !defined(Py_NAN) && !defined(Py_NO_NAN)
   // Use C99 "NAN" constant: quiet Not-A-Number (when supported)
#  define Py_NAN NAN
#endif

Or do you mean that a platform can support NaN but don't define the <math.h> NAN macro?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46640>
_______________________________________


More information about the Python-bugs-list mailing list