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

Jesus Cea jcea at jcea.es
Thu Mar 25 13:36:28 CET 2010

```-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/25/2010 07:54 AM, Georg Brandl wrote:
>>>>>> float('nan') in [float('nan')]
>>> False
>>
>> Sure, but just think of it as having two different nans there.  (You
>> could imagine thinking of the id of the nan as part of the payload.)
>
> That's interesting.  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.  Each nan comes from a different
> operation and therefore is a "different" non-number.

Infinites are "not equal" for a good reason, for example.

1/0 and 2/0 are both infinites, but one is "greater" than the other. Or
(1/0)^(1/0), an infinite infinitelly "bigger".

- --
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
jcea at jcea.es - http://www.jcea.es/     _/_/    _/_/  _/_/    _/_/  _/_/
jabber / xmpp:jcea at jabber.org         _/_/    _/_/          _/_/_/_/_/
.                              _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQCVAwUBS6tYzJlgi5GaxT1NAQL7kgP+LqjzNKOkSOZ+gTvgKfUTrF1poNP1VMC4
1LTkCcpFQYUoc4d8kk6lmzN7RdBesidbnVC2SApKTdNTAfbKMB3hjkTIzoxbx9wf
sLb5IUSqhtc+xJ+JQFepQwA7YLa64AVI23/wZcJCkqCBIg6S5DuGxhWErr3TXVgF
GqcZjhvD2lA=
=AVOO
-----END PGP SIGNATURE-----
```