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
12501250 {
12511251 npy_intp size;
12521252 npy_intp i;
1253- T last_value;
1253+ T last_value = -INFINITY ;
12541254 T current_value;
12551255
12561256 size = PyArray_DIM (array, 0 );
12571257
1258- // std::isnan is only in C++11, which we don't yet require,
1259- // so we use the "self == self" trick
12601258 for (i = 0 ; i < size; ++i) {
12611259 last_value = *((T *)PyArray_GETPTR1 (array, i));
1262- if (last_value == last_value ) {
1260+ if (! std::isnan ( last_value) ) {
12631261 break ;
12641262 }
12651263 }
@@ -1271,7 +1269,7 @@ struct _is_sorted
12711269
12721270 for (; i < size; ++i) {
12731271 current_value = *((T *)PyArray_GETPTR1 (array, i));
1274- if (current_value == current_value ) {
1272+ if (! std::isnan ( current_value) ) {
12751273 if (current_value < last_value) {
12761274 return false ;
12771275 }
You can’t perform that action at this time.
0 commit comments