From 47b8ef258bd6b3ba3c7849cb161e52f50222660a Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Thu, 2 Feb 2017 00:17:08 -0500 Subject: [PATCH] clang-tidy performance-type-promotion-in-math-fn (#236) --- EKF/ekf_helper.cpp | 4 ++-- EKF/estimator_interface.cpp | 2 +- attitude_fw/ecl_wheel_controller.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/EKF/ekf_helper.cpp b/EKF/ekf_helper.cpp index 75db55cf99..33403a14b6 100644 --- a/EKF/ekf_helper.cpp +++ b/EKF/ekf_helper.cpp @@ -768,7 +768,7 @@ void Ekf::get_innovation_test_status(uint16_t *status, float *mag, float *vel, f // return the airspeed fusion innovation test ratio *tas = sqrtf(_tas_test_ratio); // return the terrain height innovation test ratio - *hagl = sqrt(_terr_test_ratio); + *hagl = sqrtf(_terr_test_ratio); } // return a bitmask integer that describes which state estimates are valid @@ -912,7 +912,7 @@ Vector3f Ekf::calcRotVecVariances() q3 = -_state.quat_nominal(3); } float t2 = q0*q0; - float t3 = acos(q0); + float t3 = acosf(q0); float t4 = -t2+1.0f; float t5 = t2-1.0f; if ((t4 > 1e-9f) && (t5 < -1e-9f)) { diff --git a/EKF/estimator_interface.cpp b/EKF/estimator_interface.cpp index 7b043e13e0..0d95fe8456 100644 --- a/EKF/estimator_interface.cpp +++ b/EKF/estimator_interface.cpp @@ -365,7 +365,7 @@ bool EstimatorInterface::initialise_interface(uint64_t timestamp) // set the observaton buffer length to handle the minimum time of arrival between observations in combination // with the worst case delay from current time to ekf fusion time // allow for worst case 50% extension of the ekf fusion time horizon delay due to timing jitter - uint16_t ekf_delay_ms = max_time_delay_ms + (int)(ceil((float)max_time_delay_ms * 0.5f)); + uint16_t ekf_delay_ms = max_time_delay_ms + (int)(ceilf((float)max_time_delay_ms * 0.5f)); _obs_buffer_length = (ekf_delay_ms / _params.sensor_interval_min_ms) + 1; // limit to be no longer than the IMU buffer (we can't process data faster than the EKF prediction rate) diff --git a/attitude_fw/ecl_wheel_controller.cpp b/attitude_fw/ecl_wheel_controller.cpp index aa0bdfafd5..7cae0316dd 100644 --- a/attitude_fw/ecl_wheel_controller.cpp +++ b/attitude_fw/ecl_wheel_controller.cpp @@ -129,7 +129,7 @@ float ECL_WheelController::control_attitude(const struct ECL_ControlData &ctl_da /* Calculate the error */ float yaw_error = ctl_data.yaw_setpoint - ctl_data.yaw; /* shortest angle (wrap around) */ - yaw_error = (float)fmod((float)fmod((yaw_error + M_PI_F), M_TWOPI_F) + M_TWOPI_F, M_TWOPI_F) - M_PI_F; + yaw_error = (float)fmodf((float)fmodf((yaw_error + M_PI_F), M_TWOPI_F) + M_TWOPI_F, M_TWOPI_F) - M_PI_F; /*warnx("yaw_error: %.4f", (double)yaw_error);*/ /* Apply P controller: rate setpoint from current error and time constant */