diff --git a/libraries/AP_Math/AP_Math.cpp b/libraries/AP_Math/AP_Math.cpp index 0888414924..4476aec439 100644 --- a/libraries/AP_Math/AP_Math.cpp +++ b/libraries/AP_Math/AP_Math.cpp @@ -176,10 +176,10 @@ template 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_float(). The normal + // errors through any function that uses constrain_value(). The normal // float semantics already handle -Inf and +Inf if (isnan(amt)) { - return (low + high) * 0.5f; + return (low + high) / 2; } if (amt < low) {