gh-104263: Rely on Py_NAN and introduce Py_INFINITY by seberg · Pull Request #104202 · python/cpython
It seems to me code all around relies on both being correct anyway. The actual value for Py_NAN is subtly incorrect on MIPS (depending on settings) or at least nonstandard, which seems to confuse some builtin functions. (Probably it is signalling, but NumPy saw this with fmin, which probably should also ignore signalling NaNs, see also numpy/numpy#23158). The guards about `_PY_SHORT_FLOAT_REPR` making sense are relatively unrelated to NAN and INF being available. Nevertheless, I currently hide the Py_NAN definition if that is not set, since I am not sure what good alternative there is to be certain that Py_NAN is well defined. OTOH, I do suspect there is no platform where it is not and it should probably be changed?!
sunmy2019
changed the title
MAINT: Rely on Py_NAN and Py_HUGE_VAL being correctly defined
gh-104263: MAINT: Rely on Py_NAN and Py_HUGE_VAL being correctly defined
We can rely on both as Python now forces IEEE compliance and C99 so that both should always be well defined and there is no need for `math.nan` not being defined.
seberg
changed the title
gh-104263: MAINT: Rely on Py_NAN and Py_HUGE_VAL being correctly defined
MAINT: Rely on Py_NAN and introduce Py_INFINITY
seberg
changed the title
MAINT: Rely on Py_NAN and introduce Py_INFINITY
gh-104263: Rely on Py_NAN and introduce Py_INFINITY
seberg
deleted the
maint-double-nan
branch
This was referenced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters