# HG changeset patch # User Chris Cannam # Date 1580223999 0 # Node ID bd22e6f4809dc0352a25f4c16f80e6f05bfca019 # Parent 96cb7ef3cc24630e86d1ac1556b8ce48510d9634 Add eps to avoid rounding error diff -r 96cb7ef3cc24 -r bd22e6f4809d VampTestPlugin.cpp --- a/VampTestPlugin.cpp Fri Apr 21 14:33:47 2017 +0100 +++ b/VampTestPlugin.cpp Tue Jan 28 15:06:39 2020 +0000 @@ -460,9 +460,10 @@ } static -float snap(float x, float r) +double snap(double x, double r) { - int n = int(x / r + 0.5); + double eps = 1e-9; + int n = int(x / r + 0.5 + eps); return n * r; }