diff options
author | Rosen Penev <rosenp@gmail.com> | 2020-03-15 23:33:21 -0700 |
---|---|---|
committer | Rosen Penev <rosenp@gmail.com> | 2020-03-16 12:43:24 -0700 |
commit | 6d91b5c7b21926137c63561e313afd1fb72274f8 (patch) | |
tree | fb3424a20e839954df416e1af8316fc3ca3b9f78 /src/ReplayGainGlobal.cxx | |
parent | fd71514068be53a98c8f4b87d3164fd632ab24cb (diff) |
fix double promotions
Found with -Wdouble-promotion
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src/ReplayGainGlobal.cxx')
-rw-r--r-- | src/ReplayGainGlobal.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ReplayGainGlobal.cxx b/src/ReplayGainGlobal.cxx index af82c2288..b5a8d1ae0 100644 --- a/src/ReplayGainGlobal.cxx +++ b/src/ReplayGainGlobal.cxx @@ -23,24 +23,23 @@ #include "util/Math.hxx" #include <cassert> +#include <cstdlib> #include <stdexcept> -#include <stdlib.h> - static float ParsePreamp(const char *s) { assert(s != nullptr); char *endptr; - float f = strtod(s, &endptr); + float f = std::strtof(s, &endptr); if (endptr == s || *endptr != '\0') throw std::invalid_argument("Not a numeric value"); - if (f < -15 || f > 15) + if (f < -15.0f || f > 15.0f) throw std::invalid_argument("Number must be between -15 and 15"); - return pow(10, f / 20.0); + return std::pow(10.0f, f / 20.0f); } ReplayGainConfig @@ -51,13 +50,13 @@ LoadReplayGainConfig(const ConfigData &config) replay_gain_config.preamp = config.With(ConfigOption::REPLAYGAIN_PREAMP, [](const char *s){ return s != nullptr ? ParsePreamp(s) - : 1.0; + : 1.0f; }); replay_gain_config.missing_preamp = config.With(ConfigOption::REPLAYGAIN_MISSING_PREAMP, [](const char *s){ return s != nullptr ? ParsePreamp(s) - : 1.0; + : 1.0f; }); replay_gain_config.limit = config.GetBool(ConfigOption::REPLAYGAIN_LIMIT, |