Matrix: omit min max nan case with same result

I observed this during review in
https://github.com/PX4/Matrix/pull/105/files#r348386226
This commit is contained in:
Matthias Grob 2020-03-21 15:22:11 +01:00 committed by Julian Kent
parent a32892926c
commit fa7153ecfb

View File

@ -620,9 +620,7 @@ Type min(const Type x, const Type y) {
if (x_is_nan && !y_is_nan) {
return y;
}
if (!x_is_nan && y_is_nan) {
return x;
}
// either !x_is_nan && y_is_nan or both are NAN anyways
return x;
}
return (x < y) ? x : y;
@ -636,9 +634,7 @@ Type max(const Type x, const Type y) {
if (x_is_nan && !y_is_nan) {
return y;
}
if (!x_is_nan && y_is_nan) {
return x;
}
// either !x_is_nan && y_is_nan or both are NAN anyways
return x;
}
return (x > y) ? x : y;