diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2017-06-27 13:29:41 -0700 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2017-06-27 13:29:41 -0700 |
commit | 9e011f1d116daaf5abdd8d05a83341390159a21b (patch) | |
tree | 24b946d510a313f96c4427f0304ad7f145ea5df1 /gr-fft | |
parent | 99ee660ce3701a33efa1737ae341e5360661f900 (diff) | |
parent | 2577279fa5fe8d5ed93b62c2c83c523c99dfbbea (diff) |
Merge branch 'master' into next
Diffstat (limited to 'gr-fft')
-rw-r--r-- | gr-fft/lib/window.cc | 11 |
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; } |