AP_Math: Remove isnan check for non-float type

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
This commit is contained in:
Patrick José Pereira 2020-10-14 19:30:43 -03:00 committed by Peter Barker
parent 937d7bf335
commit 6ee401cb00
1 changed files with 5 additions and 3 deletions

View File

@ -265,9 +265,11 @@ T constrain_value(const T amt, const T low, const T high)
// the check for NaN as a float prevents propagation of floating point
// errors through any function that uses constrain_value(). The normal
// float semantics already handle -Inf and +Inf
if (isnan(amt)) {
INTERNAL_ERROR(AP_InternalError::error_t::constraining_nan);
return (low + high) / 2;
if (std::is_floating_point<T>::value) {
if (isnan(amt)) {
INTERNAL_ERROR(AP_InternalError::error_t::constraining_nan);
return (low + high) / 2;
}
}
if (amt < low) {