Skip to content

Commit

Permalink
Edge case im bug
Browse files Browse the repository at this point in the history
  • Loading branch information
iflint1 committed Mar 11, 2024
1 parent 71722d8 commit c550e65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utility/im_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ class Im_wrapper {
if((index_x < 0) || (index_y < 0)) {
return NA_REAL;
} else if(index_x >= static_cast<double>(number_col_)) {
if(index_x == static_cast<double>(number_col_)) { // x is on rhs boundary
if(std::abs(index_x - static_cast<double>(number_col_)) <= std::numeric_limits<double>::epsilon()) { // x is on rhs boundary
const R_xlen_t row(std::floor(index_y));
return get_matrix(row, number_col_ - 1);
} else {
return NA_REAL;
}
} else if(index_y >= static_cast<double>(number_row_)) {
if(index_y == static_cast<double>(number_row_)) { // y is on top boundary
if(std::abs(index_y - static_cast<double>(number_row_)) <= std::numeric_limits<double>::epsilon()) { // y is on top boundary
const R_xlen_t col(std::floor(index_x));
return get_matrix(number_row_ - 1, col);
} else {
Expand Down

0 comments on commit c550e65

Please sign in to comment.