summaryrefslogtreecommitdiff
path: root/gr-fft
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2017-06-27 13:28:58 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2017-06-27 13:28:58 -0700
commitd725f978a4cf21f5a9fc3dd4e02c2b7753c683d2 (patch)
treef8ac162459aafef8b051376fdb41b41594435314 /gr-fft
parent54e89c6431c249bbe560568d76800fef6a245506 (diff)
parent4a7c612bdebe268cacd60cf137252c5d1753a701 (diff)
Merge branch 'maint'
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;
}