Mercurial > hg > vamp-test-plugin
changeset 37:bd22e6f4809d
Add eps to avoid rounding error
author | Chris Cannam |
---|---|
date | Tue, 28 Jan 2020 15:06:39 +0000 |
parents | 96cb7ef3cc24 |
children | 2ea9885df069 |
files | VampTestPlugin.cpp |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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; }