-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG: Incorrect handling of not-equal comparison to nan #21685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Ping @rafaelcfsousa, could you have a look, since it was likely your PR that introduced this? |
@seberg: Yes, I am already checking the issue. |
Ok, I already know what exactly is causing this bug. The comparison kernels implemented with AVX and AVX512 use the universal intrinsic
The universal intrinsic For _CMP_NEQ_OQ (Ordered comparisons returns false for NaN operands):
For _CMP_NEQ_UQ (Unordered comparison returns true for NaN operands):
|
I assume this doesn't need a backport? |
In my point of view, we could follow one of the 4 options below to have this issue resolved:
|
Using EDIT: Whoops, copied the wrong intrinsic there... |
Sorry, yes. I got the wrong intrinsic, I meant: I do think we should swap out the intrinsic/flag used and that seems like it should be the right solution. Are you planning on making a PR? |
Yes, I will submit a PR. Give me ~1h and I will submit it (I will test the other comparison function as well). |
FWIW: Locally, I just tried switching |
Describe the issue:
For a sufficiently large array
x
, the comparisonx != 0
returns False for elements ofx
that arenan
. The result should be True. For example,The bug appears to have been introduced in gh-21483.
NumPy/Python version information:
The text was updated successfully, but these errors were encountered: