summaryrefslogtreecommitdiff
path: root/gr-fft
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2017-06-27 13:29:52 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2017-06-27 13:29:52 -0700
commitd2f4ce96bd086ef093b5db7e0606cad79f595e7f (patch)
treecc94a19dac9c9da11f357f1bdf786fcf44330045 /gr-fft
parent1e02521a72304f898b3523148f35038f53bbb056 (diff)
parent9e011f1d116daaf5abdd8d05a83341390159a21b (diff)
Merge branch 'next' into python3
Diffstat (limited to 'gr-fft')
-rw-r--r--gr-fft/lib/window.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/gr-fft/lib/window.cc b/gr-fft/lib/window.cc
index 126b28978d..cfbdb93dbd 100644
--- a/gr-fft/lib/window.cc
+++ b/gr-fft/lib/window.cc
@@ -261,10 +261,19 @@ namespace gr {
double inm1 = 1.0/((double)(ntaps-1));
double temp;
- for(int i = 0; i < ntaps; i++) {
+ /* extracting first and last element out of the loop, since
+ sqrt(1.0-temp*temp) might trigger unexpected floating point behaviour
+ if |temp| = 1.0+epsilon, which can happen for i==0 and
+ 1/i==1/(ntaps-1)==inm1 ; compare
+ https://github.com/gnuradio/gnuradio/issues/1348 .
+ In any case, the 0. Bessel function of first kind is 1 at point 0.
+ */
+ taps[0] = IBeta;
+ for(int i = 1; i < ntaps-1; i++) {
temp = 2*i*inm1 - 1;
taps[i] = Izero(beta*sqrt(1.0-temp*temp)) * IBeta;
}
+ taps[ntaps-1] = IBeta;
return taps;
}