Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 14d5266

Browse filesBrowse files
committed
Only skip NaNs, not all non-finite values
1 parent 3be4490 commit 14d5266
Copy full SHA for 14d5266

File tree

Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed

‎src/_path.h

Copy file name to clipboardExpand all lines: src/_path.h
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,9 +1195,11 @@ struct _is_sorted
11951195

11961196
size = PyArray_DIM(array, 0);
11971197

1198+
// std::isnan is only in C++11, which we don't yet require,
1199+
// so we use the the "self == self" trick
11981200
for (i = 0; i < size; ++i) {
11991201
last_value = *((T *)PyArray_GETPTR1(array, i));
1200-
if (std::isfinite(last_value)) {
1202+
if (last_value == last_value) {
12011203
break;
12021204
}
12031205
}
@@ -1209,7 +1211,7 @@ struct _is_sorted
12091211

12101212
for (; i < size; ++i) {
12111213
current_value = *((T *)PyArray_GETPTR1(array, i));
1212-
if (std::isfinite(current_value)) {
1214+
if (current_value == current_value) {
12131215
if (current_value < last_value) {
12141216
return false;
12151217
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.