[issue46640] Python can now use the C99 NAN constant
STINNER Victor
report at bugs.python.org
Fri Feb 4 15:57:28 EST 2022
STINNER Victor <vstinner at python.org> added the comment:
Python/dtoa.c uses:
/* Standard NaN used by _Py_dg_stdnan. */
#define NAN_WORD0 0x7ff80000
#define NAN_WORD1 0
/* Return a 'standard' NaN value.
There are exactly two quiet NaNs that don't arise by 'quieting' signaling
NaNs (see IEEE 754-2008, section 6.2.1). If sign == 0, return the one whose
sign bit is cleared. Otherwise, return the one whose sign bit is set.
*/
double
_Py_dg_stdnan(int sign)
{
U rv;
word0(&rv) = NAN_WORD0;
word1(&rv) = NAN_WORD1;
if (sign)
word0(&rv) |= Sign_bit;
return dval(&rv);
}
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46640>
_______________________________________
More information about the Python-bugs-list
mailing list