Mark Dickinson <dicki...@gmail.com> added the comment: Tim, I'm in need of some advice on Py_IS_INFINITY. It's currently implemented (on platforms that don't provide isinf) as
#define Py_IS_INFINITY(X) ((X) && (X)*0.5 == (X)) I'd like to rewrite it as something like: #define Py_IS_INFINITY_D(X) ((X) < -DBL_MAX || (X) > DBL_MAX) #define Py_IS_INFINITY_F(X) ((X) < -FLT_MAX || (X) > FLT_MAX) #define Py_IS_INFINITY(X) (sizeof(X) == sizeof(double) ? Py_IS_INFINITY_D(X) : Py_IS_INFINITY_F(X)) Are there any hidden (or obvious) numerical pitfalls with this approach? The reason for the rewrite is that the current Py_IS_INFINITY can give false positives on x86 for values that are pretending to be doubles, but are actually coming from an 80-bit x87 register. ---------- nosy: +tim_one _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4575> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com