From c77a4a2c54802465982c1a7a6e8ed20bec171d77 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Tue, 19 May 2020 13:21:43 +0200 Subject: [PATCH] compute recip from ratio to solve numerical issues --- resampler.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resampler.hh b/resampler.hh index 0114f4b..3fade0d 100644 --- a/resampler.hh +++ b/resampler.hh @@ -35,7 +35,7 @@ public: void operator ()(IO *output, const IO *input, TYPE diff, int samples, int stride = 1) { TYPE ratio = rate / (rate + diff); - TYPE recip = (rate + diff) / rate; + TYPE recip = TYPE(1) / ratio; for (int i = 0; i < samples - TAPS; ++i) { IO sum = 0; int s0 = nearbyint(i * ratio);