From c550e655ca97e971c300855448e4397807445bb3 Mon Sep 17 00:00:00 2001 From: Ian Flint Date: Tue, 12 Mar 2024 00:07:02 +1100 Subject: [PATCH] Edge case im bug --- src/utility/im_wrapper.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utility/im_wrapper.hpp b/src/utility/im_wrapper.hpp index 9867c60..867eb3e 100644 --- a/src/utility/im_wrapper.hpp +++ b/src/utility/im_wrapper.hpp @@ -57,14 +57,14 @@ class Im_wrapper { if((index_x < 0) || (index_y < 0)) { return NA_REAL; } else if(index_x >= static_cast(number_col_)) { - if(index_x == static_cast(number_col_)) { // x is on rhs boundary + if(std::abs(index_x - static_cast(number_col_)) <= std::numeric_limits::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(number_row_)) { - if(index_y == static_cast(number_row_)) { // y is on top boundary + if(std::abs(index_y - static_cast(number_row_)) <= std::numeric_limits::epsilon()) { // y is on top boundary const R_xlen_t col(std::floor(index_x)); return get_matrix(number_row_ - 1, col); } else {