Skip to content

Commit

Permalink
round to lround
Browse files Browse the repository at this point in the history
round returns a float. lround returns an int.

Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Mar 31, 2022
1 parent 0704624 commit de063c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/exiv2/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ class ValueType : public Value {
const auto v = value_.at(n);
if (static_cast<decltype(v)>(std::numeric_limits<I>::min()) <= v &&
v <= static_cast<decltype(v)>(std::numeric_limits<I>::max())) {
return static_cast<I>(std::round(v));
return static_cast<I>(std::lround(v));
} else {
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ Rational floatToRationalCast(float f) {
if (Safe::abs(d_as_long) > 21474836) {
den = 1;
}
const auto nom = static_cast<int32_t>(std::round(d * den));
const auto nom = static_cast<int32_t>(std::lround(d * den));
const int32_t g = gcd(nom, den);

return {nom / g, den / g};
Expand Down

0 comments on commit de063c7

Please sign in to comment.