bar: Use strtod instead of strtof

This makes the function more consistent, since it actually returns a
double and it also fixes the tests that use EXPECT_DOUBLE_EQ
This commit is contained in:
patrick96 2018-05-09 22:48:05 +02:00 committed by Patrick Ziegler
parent cc9423e682
commit 4e5628dd5f

View File

@ -32,12 +32,12 @@ inline double geom_format_to_pixels(std::string str, double max) {
if ((i = str.find(':')) != std::string::npos) {
std::string a = str.substr(0, i - 1);
std::string b = str.substr(i + 1);
return math_util::percentage_to_value<double>(strtof(a.c_str(), nullptr), max) + strtof(b.c_str(), nullptr);
return math_util::percentage_to_value<double>(strtod(a.c_str(), nullptr), max) + strtod(b.c_str(), nullptr);
} else {
if (str.find('%') != std::string::npos) {
return math_util::percentage_to_value<double>(strtof(str.c_str(), nullptr), max);
return math_util::percentage_to_value<double>(strtod(str.c_str(), nullptr), max);
} else {
return strtof(str.c_str(), nullptr);
return strtod(str.c_str(), nullptr);
}
}
}