Skip to content

Commit eda2b5f

Browse files
authored
Merge pull request #3507 from lindsayad/fix-compare
Fix NumericVector::compare
2 parents 8049421 + 996dae5 commit eda2b5f

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/numerics/numeric_vector.C

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,14 @@ int NumericVector<T>::compare (const NumericVector<T> & other_vector,
114114
int first_different_i = std::numeric_limits<int>::max();
115115
numeric_index_type i = first_local_index();
116116

117-
do
118-
{
119-
if (std::abs((*this)(i) - other_vector(i)) > threshold)
120-
first_different_i = i;
121-
else
122-
i++;
123-
}
124117
while (first_different_i==std::numeric_limits<int>::max()
125-
&& i<last_local_index());
118+
&& i<last_local_index())
119+
{
120+
if (std::abs((*this)(i) - other_vector(i)) > threshold)
121+
first_different_i = i;
122+
else
123+
i++;
124+
}
126125

127126
// Find the correct first differing index in parallel
128127
this->comm().min(first_different_i);

0 commit comments

Comments
 (0)