>From ef5ffe4324472e80b3c81a8323172d552a2448bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20M=C3=BCller?=
Date: Tue, 27 Jun 2017 11:53:14 +0200 Subject: [PATCH] Fixed floating point math bug (#1348) https://github.com/gnuradio/gnuradio/issues/1348 We were doing floating point math wrong. --- gr-fft/lib/window.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gr-fft/lib/window.cc b/gr-fft/lib/window.cc index 126b28978..e80d469e9 100644 --- a/gr-fft/lib/window.cc +++ b/gr-fft/lib/window.cc @@ -30,9 +30,10 @@ namespace gr { namespace fft { -#define IzeroEPSILON 1E-21 /* Max error acceptable in Izero */ +#define BESSEL_EPSILON 1E-21 /* Max error acceptable in bessel_i_zero */ - static double Izero(double x) + /*! \brief Iterative first kind Bessel function approximation */ + static double bessel_i_zero(double x) { double sum, u, halfx, temp; int n; @@ -45,7 +46,7 @@ namespace gr { temp *= temp; u *= temp; sum += u; - } while (u >= IzeroEPSILON*sum); + } while (u >= BESSEL_EPSILON*sum); return(sum); } @@ -257,13 +258,17 @@ namespace gr { std::vector