Commit 692c21606f7a25a63446aabcc51c6ddf7e768767
1 parent
ce238e96
Avoid rounding error in GCTAModelSpatialLookup lookup constructor (#2878)
Showing
1 changed file
with
1 additions
and
1 deletions
inst/cta/src/GCTAModelSpatialLookup.cpp
| @@ -194,7 +194,7 @@ GCTAModelSpatialLookup::GCTAModelSpatialLookup(const double& maxrad, | @@ -194,7 +194,7 @@ GCTAModelSpatialLookup::GCTAModelSpatialLookup(const double& maxrad, | ||
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | // Setup radial axis vector | 196 | // Setup radial axis vector |
| 197 | - int nrad = maxrad/radbin; | 197 | + int nrad = int(maxrad/radbin+0.5); |
| 198 | std::vector<double> rad_lo(nrad); | 198 | std::vector<double> rad_lo(nrad); |
| 199 | std::vector<double> rad_hi(nrad); | 199 | std::vector<double> rad_hi(nrad); |
| 200 | for (int i = 0; i < nrad; ++i) { | 200 | for (int i = 0; i < nrad; ++i) { |