summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/math
diff options
context:
space:
mode:
authorArtem Pisarenko <artem.k.pisarenko@gmail.com>2020-01-02 14:18:47 +0600
committerMartin Braun <martin.braun@ettus.com>2020-01-02 11:04:40 -0800
commit58ef2ed659776f82d0eb787b2728e0dffd6d8dbe (patch)
treee77575ddf04f70f581d9f1e381b25459e05f9ed2 /gnuradio-runtime/lib/math
parentcddbc0cb41aa87f6ae3699dd632de07efb1682ff (diff)
runtime: fix python math script generating wrong sine table
Fixes commit 48d535e9d9d95524b2c8ed35b44c7eda541aea68
Diffstat (limited to 'gnuradio-runtime/lib/math')
-rw-r--r--gnuradio-runtime/lib/math/gen_sine_table.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/gnuradio-runtime/lib/math/gen_sine_table.py b/gnuradio-runtime/lib/math/gen_sine_table.py
index 5b459fa1a3..d25cffc859 100644
--- a/gnuradio-runtime/lib/math/gen_sine_table.py
+++ b/gnuradio-runtime/lib/math/gen_sine_table.py
@@ -20,7 +20,6 @@
# Boston, MA 02110-1301, USA.
#
-from __future__ import division
from __future__ import unicode_literals
import math
import sys
@@ -41,7 +40,7 @@ def gen_approx_table (f, nentries, min_x, max_x):
a = (i * incx) + min_x
b = ((i + 1) * incx) + min_x
m = (f(b)-f(a)) / (b-a)
- c = (3*a+b)*(f(a)-f(b))/(4*(b-a)) + (f((a+b)/2) + f(a))//2
+ c = (3.0*a+b)*(f(a)-f(b))/(4.0*(b-a)) + (f((a+b)/2.0) + f(a))/2.0
abs_error = c+m*a-f(a)
r.append ((m, c, abs_error))
return r
@@ -71,7 +70,7 @@ def gen_sine_table ():
# sys.stdout.write ('static const double sine_table[%d][2] = {\n'% (nentries,))
for e in t:
- sys.stdout.write (' { %22.15e, %22.15e },\n' % (2 * e[0], e[1]))
+ sys.stdout.write (' { %22.15e, %22.15e },\n' % (2.0 * e[0], e[1]))
# sys.stdout.write ('};\n')