diff --git a/triqs/gfs/meshes/linear.hpp b/triqs/gfs/meshes/linear.hpp index 18bc28bc..6f59c062 100644 --- a/triqs/gfs/meshes/linear.hpp +++ b/triqs/gfs/meshes/linear.hpp @@ -193,13 +193,14 @@ namespace triqs { namespace gfs { /// Approximation of a point of the domain by a mesh point template - std::tuple windowing (linear_mesh const & mesh, typename D::point_t const & x) { + std::tuple windowing (linear_mesh const & mesh, typename D::point_t const & x) { double a = (x - mesh.x_min())/mesh.delta(); - long i = std::floor(a); - bool in = (! ((i<0) || (i>long(mesh.size())-1))); + long i = std::floor(a), imax = long(mesh.size())-1; + bool in = (i>=0) && (i