A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-September/049055.html below:

[Python-checkins] python/dist/src/Objects floatobject.c, 2.132, 2.133

[Python-Dev] Re: [Python-checkins] python/dist/src/Objects floatobject.c, 2.132, 2.133Armin Rigo arigo at tunes.org
Thu Sep 23 11:45:02 CEST 2004
Hello Tim,

Your float.richcompare patch, trying to map the C semantics at the Python
level, introduces artificial results when comparing NaN's with longs:

>>> float('nan') > 0
False
>>> float('nan') > 0L
True

I am not aware of all the problems and various platforms, but clearly in the
patch 'vsign' by itself doesn't make much sense if 'v' is a NaN.

Wouldn't all compilers and platforms compare NaNs "strangely", for some
detectable definition of "stange"?  Something along the lines of:

#define Py_IS_NAN(v)  (!Py_IS_INFINITY(v)  &&          \
                       ( ((v) < 0.0 && (v) > 0.0) ||   \
                         !((v) < 1.0 || (v) > -1.0) )


Armin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4