mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-02 05:04:08 +08:00
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:
parent
a32892926c
commit
fa7153ecfb
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user