File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -1250,16 +1250,14 @@ struct _is_sorted
1250
1250
{
1251
1251
npy_intp size;
1252
1252
npy_intp i;
1253
- T last_value;
1253
+ T last_value = -INFINITY ;
1254
1254
T current_value;
1255
1255
1256
1256
size = PyArray_DIM (array, 0 );
1257
1257
1258
- // std::isnan is only in C++11, which we don't yet require,
1259
- // so we use the "self == self" trick
1260
1258
for (i = 0 ; i < size; ++i) {
1261
1259
last_value = *((T *)PyArray_GETPTR1 (array, i));
1262
- if (last_value == last_value ) {
1260
+ if (! std::isnan ( last_value) ) {
1263
1261
break ;
1264
1262
}
1265
1263
}
@@ -1271,7 +1269,7 @@ struct _is_sorted
1271
1269
1272
1270
for (; i < size; ++i) {
1273
1271
current_value = *((T *)PyArray_GETPTR1 (array, i));
1274
- if (current_value == current_value ) {
1272
+ if (! std::isnan ( current_value) ) {
1275
1273
if (current_value < last_value) {
1276
1274
return false ;
1277
1275
}
You can’t perform that action at this time.
0 commit comments