numpy - python "is" returns True but "==" returns False -
"==" should not be returned unless true "gives" right? [101]: NPNAN NPNN is NPNAN Out [101]: Really [102]: NPNAN == NP. Nan out [102]: In the wrong [103]: NP. NaN == np.nan out [103]: False [104]: np.NaN == np.NAN out [104]: Incorrect
Edit:
What float Nain bus are the 3 expressions for the legacy of the old NMP versions or for their other uses? No, for no you have found one of the exceptions. According to, the NAN is not equal to anything, not even by itself: Compared with an NAN, always gives an anord result while comparing itself. Not only behave like this: As per the IEEE standard, there will be any programming language implementing floating point arithmetic. Common Capitalization Name for Multiple Spelling. It is an abbreviation for not a number and individual people have briefly taken advantage of it briefly Through the conference, for a successful comparison, the
& gt; & Gt; & Gt; Nain = float ('nan')> gt; & Gt; & Gt; Nain hai nain true & gt; & Gt; & Gt; Nain == Nain false
is always the same object Is going to be
true , but
== is also not guaranteed to return boolean. From:
incorrect and
true are returned, however, So if the comparison operator is used in the Boolean reference (for example,
if is in the statement state), then python
bool () value To determine whether the result is true or false.
Comments
Post a Comment