[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why float('Nan') == float('Nan') is False

Because all comparisons with NAN return false, that's the spec.  is NAN > 0? False.  Is NAN< 0?   False.  Is NAN == 0?  False.  Is NAN == <anything>? False. So: Is NAN == NAN? False. And one more:  Is NAN < 1.0e18? False

This makes some sense because NAN is Not A Number, so any comparison to a number fails.

--- Joseph S. 
-----Original Message-----
From: ast <none at gmail.com> 
Sent: Wednesday, February 13, 2019 8:21 AM
To: python-list at python.org
Subject: Why float('Nan') == float('Nan') is False


 >>> float('Nan') == float('Nan')

Why ?