diff --git a/ArduPlane/Attitude.pde b/ArduPlane/Attitude.pde index 8f7429c462..51f83fba24 100644 --- a/ArduPlane/Attitude.pde +++ b/ArduPlane/Attitude.pde @@ -358,7 +358,7 @@ static void set_servos(void) */ if ( (control_mode == CIRCLE || control_mode >= FLY_BY_WIRE_B) && - (abs(home.alt - current_loc.alt) < 1000) && + (labs(home.alt - current_loc.alt) < 1000) && ((airspeed.use()? airspeed.get_airspeed_cm() : g_gps->ground_speed) < 500 ) && !(control_mode==AUTO && takeoff_complete == false) ) { diff --git a/ArduPlane/commands_logic.pde b/ArduPlane/commands_logic.pde index c2550f2213..c84e189330 100644 --- a/ArduPlane/commands_logic.pde +++ b/ArduPlane/commands_logic.pde @@ -435,7 +435,7 @@ static void do_wait_delay() static void do_change_alt() { - condition_rate = abs((int)next_nonnav_command.lat); + condition_rate = labs((int)next_nonnav_command.lat); condition_value = next_nonnav_command.alt; if(condition_value < current_loc.alt) condition_rate = -condition_rate; target_altitude_cm = current_loc.alt + (condition_rate / 10); // Divide by ten for 10Hz update diff --git a/libraries/AP_Math/examples/location/location.pde b/libraries/AP_Math/examples/location/location.pde index 9b569a8aeb..aaea96b53c 100644 --- a/libraries/AP_Math/examples/location/location.pde +++ b/libraries/AP_Math/examples/location/location.pde @@ -104,7 +104,7 @@ static void test_one_offset(struct Location &loc, brg_error += 360; } - if (abs(dist - dist2) > 1.0 || + if (fabs(dist - dist2) > 1.0 || brg_error > 1.0) { Serial.printf("Failed offset test brg_error=%f dist_error=%f\n", brg_error, dist-dist2); diff --git a/libraries/AP_Navigation/Navigation.cpp b/libraries/AP_Navigation/Navigation.cpp index 9802257a89..c38e1c8b38 100644 --- a/libraries/AP_Navigation/Navigation.cpp +++ b/libraries/AP_Navigation/Navigation.cpp @@ -117,7 +117,7 @@ void Navigation::calc_long_scaling(int32_t lat) { // this is used to offset the shrinking longitude as we go towards the poles - float rads = (abs(lat) / T7) * 0.0174532925; + float rads = (fabs(lat) / T7) * 0.0174532925; _scaleLongDown = cos(rads); _scaleLongUp = 1.0f / cos(rads); }