[issue14521] math.copysign(1., float('nan')) returns -1.
mattip
report at bugs.python.org
Sun Apr 8 09:10:28 CEST 2012
mattip <matti.picus at gmail.com> added the comment:
I was going to add a test for this to Lib/test/test_math.py, but found this comment:
# copysign(INF, NAN) may be INF or it may be NINF, since
# we don't know whether the sign bit of NAN is set on any
# given platform.
I would try to claim this is fixable, by this patch:
--- Include\pymath.h.orig Sun Apr 08 10:02:37 2012
+++ Include\pymath.h Sun Apr 08 10:02:41 2012
@@ -150,7 +150,7 @@
* doesn't support NaNs.
*/
#if !defined(Py_NAN) && !defined(Py_NO_NAN)
-#define Py_NAN (Py_HUGE_VAL * 0.)
+#define Py_NAN abs(Py_HUGE_VAL * 0.)
#endif
/* Py_OVERFLOWED(X)
Should I rework the tests to reflect this and submit a patch?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14521>
_______________________________________
More information about the Python-bugs-list
mailing list