Skip to content

Commit

Permalink
update rounding in quarantine
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisJones687 committed Dec 19, 2024
1 parent 9354e1f commit 3e2363c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions inst/include/quarantine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,20 @@ class QuarantineEscapeAction
DistDir closest;
if (directions_.at(Direction::N)
&& (i - n) * north_south_resolution_ < mindist) {
mindist = static_cast<int>(std::floor((i - n) * north_south_resolution_));
mindist = std::lround((i - n) * north_south_resolution_);
closest = std::make_tuple(mindist, Direction::N);
}
if (directions_.at(Direction::S)
&& (s - i) * north_south_resolution_ < mindist) {
mindist = static_cast<int>(std::floor((s - i) * north_south_resolution_));
mindist = std::lround((s - i) * north_south_resolution_);
closest = std::make_tuple(mindist, Direction::S);
}
if (directions_.at(Direction::E) && (e - j) * west_east_resolution_ < mindist) {
mindist = static_cast<int>(std::floor((e - j) * west_east_resolution_));
mindist = std::lround((e - j) * west_east_resolution_);
closest = std::make_tuple(mindist, Direction::E);
}
if (directions_.at(Direction::W) && (j - w) * west_east_resolution_ < mindist) {
mindist = static_cast<int>(std::floor((j - w) * west_east_resolution_));
mindist = std::lround((j - w) * west_east_resolution_);
closest = std::make_tuple(mindist, Direction::W);
}
return closest;
Expand Down

0 comments on commit 3e2363c

Please sign in to comment.