From 8ff9923e07b1f675b7eb59089a499bc730387494 Mon Sep 17 00:00:00 2001 From: Fabio D'Urso Date: Fri, 4 Jan 2019 20:36:56 +0100 Subject: [PATCH] SITL: parse home coordinates as double (not float) to avoid precision loss --- libraries/SITL/SIM_Aircraft.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/SITL/SIM_Aircraft.cpp b/libraries/SITL/SIM_Aircraft.cpp index 6b3fa0c1e1..165ec676ed 100644 --- a/libraries/SITL/SIM_Aircraft.cpp +++ b/libraries/SITL/SIM_Aircraft.cpp @@ -126,9 +126,9 @@ bool Aircraft::parse_home(const char *home_str, Location &loc, float &yaw_degree } memset(&loc, 0, sizeof(loc)); - loc.lat = static_cast(strtof(lat_s, nullptr) * 1.0e7f); - loc.lng = static_cast(strtof(lon_s, nullptr) * 1.0e7f); - loc.alt = static_cast(strtof(alt_s, nullptr) * 1.0e2f); + loc.lat = static_cast(strtod(lat_s, nullptr) * 1.0e7); + loc.lng = static_cast(strtod(lon_s, nullptr) * 1.0e7); + loc.alt = static_cast(strtod(alt_s, nullptr) * 1.0e2); if (loc.lat == 0 && loc.lng == 0) { // default to CMAC instead of middle of the ocean. This makes