diff --git a/src/tags_int.cpp b/src/tags_int.cpp index a1d6a88c..8377dcdd 100644 --- a/src/tags_int.cpp +++ b/src/tags_int.cpp @@ -2607,16 +2607,14 @@ namespace Exiv2 { URational ur(1, 1); const double tmp = std::exp(std::log(2.0) * static_cast(shutterSpeedValue)); if (tmp > 1) { - // Add 0.5 for rounding. - const double x = tmp + 0.5; + const double x = std::round(tmp); // Check that x is within the range of a uint32_t before casting. if (x <= std::numeric_limits::max()) { ur.second = static_cast(x); } } else { - // Add 0.5 for rounding. - const double x = 1/tmp + 0.5; + const double x = std::round(1/tmp); // Check that x is within the range of a uint32_t before casting. if (0 <= x && x <= std::numeric_limits::max()) { ur.first = static_cast(x);