summaryrefslogtreecommitdiff
path: root/gr-fft
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2017-06-27 13:28:47 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2017-06-27 13:28:47 -0700
commit4a7c612bdebe268cacd60cf137252c5d1753a701 (patch)
tree43acc36404151fbd3032bfd8051cd63dbe086889 /gr-fft
parentaa056812b754d1475732227ec0ecf2ff74a4858f (diff)
parent071d27a8b9ce11594fc387be2f3fee58b6813d4d (diff)
Merge remote-tracking branch 'github/pr/1349' into 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;
}