From 4e5628dd5f525383e7b20c4ba922dd8364250308 Mon Sep 17 00:00:00 2001 From: patrick96 Date: Wed, 9 May 2018 22:48:05 +0200 Subject: [PATCH] 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 --- include/components/bar.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/components/bar.hpp b/include/components/bar.hpp index a5cfbeda..8b45b011 100644 --- a/include/components/bar.hpp +++ b/include/components/bar.hpp @@ -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(strtof(a.c_str(), nullptr), max) + strtof(b.c_str(), nullptr); + return math_util::percentage_to_value(strtod(a.c_str(), nullptr), max) + strtod(b.c_str(), nullptr); } else { if (str.find('%') != std::string::npos) { - return math_util::percentage_to_value(strtof(str.c_str(), nullptr), max); + return math_util::percentage_to_value(strtod(str.c_str(), nullptr), max); } else { - return strtof(str.c_str(), nullptr); + return strtod(str.c_str(), nullptr); } } }