8000 Only skip NaNs, not all non-finite values · matplotlib/matplotlib@14d5266 · GitHub
[go: up one dir, main page]

Skip to content

Commit 14d5266

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

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/_path.h

Lines 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