A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-March/098921.html below:

[Python-Dev] Why is nan != nan?

[Python-Dev] Why is nan != nan? [Python-Dev] Why is nan != nan?Raymond Hettinger raymond.hettinger at gmail.com
Fri Mar 26 01:00:03 CET 2010
On Mar 25, 2010, at 4:21 PM, Georg Brandl wrote:

> Am 25.03.2010 22:45, schrieb Greg Ewing:
>> Georg Brandl wrote:
>>> Thinking of each value created by float('nan') as
>>> a different nan makes sense to my naive mind, and it also explains
>>> nicely the behavior present right now.
>> 
>> Not entirely:
>> 
>>   x = float('NaN')
>>   y = x
>>   if x == y:
>>     ...
>> 
>> There it's hard to argue that the NaNs being compared
>> result from different operations.
>> 
>> It does suggest a potential compromise, though: a single
>> NaN object compares equal to itself, but different NaN
>> objects are never equal (more or less what dict membership
>> testing does now, but extended to all == comparisons).
>> 
>> Whether that's a *sane* compromise I'm not sure.
> 
> FWIW, I like it.
> 
> Georg
> 

+1

Raymond

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