[issue14381] Intern certain integral floats for memory savings and performance
Kristján Valur Jónsson
report at bugs.python.org
Thu Apr 19 23:06:28 CEST 2012
Kristján Valur Jónsson <kristjan at ccpgames.com> added the comment:
return *(PY_LONG_LONG*)&fval == 0;
There is no aliasing, because there are no pointer variables in existence.
If we did this:
double *pfval = &fval;
PY_LONG_LONG *pl = (PY_LONG_LONG*)pfval
return *pfval == 0
Then we would have aliasing. Because "pfval" in this example doesn't exist but is merely a temporary, there is no aliasing.
As for IEEE compatibility, I don't think we could have our own floating point formatting library if we didn't make that assumption, but I might be wrong about that. On the other hand, I don't think there is a supported python architecture that defines positive zero as anything else than bitwise zero. And should such a platform be found, it is easy enough to disable this code for it.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14381>
_______________________________________
More information about the Python-bugs-list
mailing list