From 201031790ec8c855ec2eaf7883652ad37b164208 Mon Sep 17 00:00:00 2001
From: Andrej Rode <mail@andrejro.de>
Date: Sat, 17 Feb 2018 14:02:04 +0100
Subject: fixup! fec: convert viterbi sub-library to valid C++ in correct
 namespace

---
 gnuradio-runtime/lib/math/random.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'gnuradio-runtime/lib/math/random.cc')

diff --git a/gnuradio-runtime/lib/math/random.cc b/gnuradio-runtime/lib/math/random.cc
index 401ba89735..5ebe174914 100644
--- a/gnuradio-runtime/lib/math/random.cc
+++ b/gnuradio-runtime/lib/math/random.cc
@@ -151,7 +151,7 @@ namespace gr {
   float
   random::impulse(float factor = 5)
   {
-    float z = -M_SQRT2 * logf(ran1());
+    float z = -GR_M_SQRT2 * logf(ran1());
     if(fabsf(z) <= factor)
       return 0.0;
     else
-- 
cgit v1.2.3


From 886ce0f13b4135c1206c26786e06a524e92fc271 Mon Sep 17 00:00:00 2001
From: Andrej Rode <mail@andrejro.de>
Date: Sat, 17 Feb 2018 23:24:10 +0100
Subject: math: replace M_PI and derivatives with GR_M_PI defines

---
 gnuradio-runtime/include/gnuradio/math.h           |   17 +-
 gnuradio-runtime/include/gnuradio/nco.h            |   24 +-
 gnuradio-runtime/lib/math/qa_fxpt.cc               |   17 +-
 gnuradio-runtime/lib/math/qa_fxpt_nco.cc           |   12 +-
 gnuradio-runtime/lib/math/random.cc                |    6 +-
 gnuradio-runtime/lib/math/vco.h                    |   14 +-
 gr-analog/lib/cpfsk_bc_impl.cc                     |   15 +-
 gr-analog/lib/cpm.cc                               |   21 +-
 gr-analog/lib/fmdet_cf_impl.cc                     |    4 +-
 gr-analog/lib/frequency_modulator_fc_impl.cc       |    5 +-
 gr-analog/lib/pll_carriertracking_cc_impl.cc       |   17 +-
 gr-analog/lib/pll_freqdet_cf_impl.cc               |   17 +-
 gr-analog/lib/pll_refout_cc_impl.cc                |   14 +-
 gr-analog/lib/sig_source_X_impl.cc.t               |   49 +-
 gr-analog/lib/squelch_base_cc_impl.cc              |    7 +-
 gr-analog/lib/squelch_base_ff_impl.cc              |    7 +-
 gr-blocks/lib/control_loop.cc                      |    4 +-
 gr-blocks/lib/qa_rotator.cc                        |   23 +-
 gr-blocks/tests/benchmark_nco.cc                   |   30 +-
 gr-blocks/tests/benchmark_vco.cc                   |   24 +-
 gr-channels/lib/cfo_model_impl.cc                  |    9 +-
 gr-channels/lib/channel_model2_impl.cc             |    7 +-
 gr-channels/lib/flat_fader_impl.cc                 |   21 +-
 gr-channels/lib/selective_fading_model2_impl.cc    |   12 +-
 gr-channels/lib/selective_fading_model_impl.cc     |   12 +-
 gr-channels/lib/sincostable.h                      |    8 +-
 gr-digital/lib/constellation.cc                    |   41 +-
 gr-digital/lib/constellation_receiver_cb_impl.cc   |    3 +-
 gr-digital/lib/constellation_receiver_cb_impl.h    |    5 +-
 gr-digital/lib/cpmmod_bc_impl.cc                   |    5 +-
 gr-digital/lib/ofdm_cyclic_prefixer_impl.cc        |    9 +-
 gr-digital/lib/ofdm_frame_acquisition_impl.cc      |   11 +-
 gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc   |   13 +-
 gr-digital/lib/ofdm_frame_sink_impl.cc             |    8 +-
 gr-dtv/lib/atsc/atsc_fpll_impl.cc                  |    6 +-
 gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.cc        | 1461 ++++++++++----------
 gr-dtv/lib/dvbs2/dvbs2_physical_cc_impl.cc         |   21 +-
 gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc  |   24 +-
 gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc     |   12 +-
 gr-dtv/lib/dvbt2/dvbt2_modulator_bc_impl.cc        |   15 +-
 gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc           |    7 +-
 gr-dtv/lib/dvbt2/dvbt2_pilotgenerator_cc_impl.cc   |    7 +-
 gr-fft/lib/goertzel.cc                             |    7 +-
 gr-fft/lib/window.cc                               |   19 +-
 gr-filter/lib/firdes.cc                            |   81 +-
 .../lib/freq_xlating_fir_filter_XXX_impl.cc.t      |    5 +-
 gr-filter/lib/pfb_arb_resampler.cc                 |   29 +-
 gr-filter/lib/pfb_decimator_ccf_impl.cc            |    5 +-
 gr-filter/lib/qa_mmse_fir_interpolator_cc.cc       |   15 +-
 gr-filter/lib/qa_mmse_fir_interpolator_ff.cc       |    9 +-
 gr-filter/lib/qa_mmse_interp_differentiator_cc.cc  |   23 +-
 gr-filter/lib/qa_mmse_interp_differentiator_ff.cc  |   23 +-
 52 files changed, 1149 insertions(+), 1111 deletions(-)

(limited to 'gnuradio-runtime/lib/math/random.cc')

diff --git a/gnuradio-runtime/include/gnuradio/math.h b/gnuradio-runtime/include/gnuradio/math.h
index 9d96ae2555..ce37f6ca84 100644
--- a/gnuradio-runtime/include/gnuradio/math.h
+++ b/gnuradio-runtime/include/gnuradio/math.h
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2003,2005,2008,2013 Free Software Foundation, Inc.
+ * Copyright 2003,2005,2008,2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -31,8 +31,21 @@
 #include <gnuradio/api.h>
 #include <gnuradio/gr_complex.h>
 
+/*
+ * \brief Define commonly used mathematical constants
+ * \ingroup misc
+ *
+ * Mathematical constants are neither defined in the C standard
+ * nor the C++ standard. For -std=c{++}11 M_LOG2E and M_SQRT2 won't
+ * compile. GR_M_PI actually works with C++ but is defined here for the sake
+ * of consistency.
+ */
+#define GR_M_LOG2E  1.4426950408889634074   /* log_2 e */
+#define GR_M_PI     3.14159265358979323846  /* pi */
+#define GR_M_PI_4   0.78539816339744830961566084582     /* pi/4 */
+#define GR_M_TWOPI  (2*GR_M_PI)             /* 2*pi */
 #define GR_M_SQRT2	1.41421356237309504880	/* sqrt(2) */
-#define GR_M_LOG2E	1.4426950408889634074	/* log_2 e */
+
 
 namespace gr {
 
diff --git a/gnuradio-runtime/include/gnuradio/nco.h b/gnuradio-runtime/include/gnuradio/nco.h
index aff72068b9..e2256c3b70 100644
--- a/gnuradio-runtime/include/gnuradio/nco.h
+++ b/gnuradio-runtime/include/gnuradio/nco.h
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2002,2013 Free Software Foundation, Inc.
+ * Copyright 2002,2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -25,6 +25,8 @@
 
 #include <gnuradio/sincos.h>
 #include <gnuradio/gr_complex.h>
+#include <gnuradio/math.h>
+
 #include <vector>
 #include <cmath>
 
@@ -69,24 +71,24 @@ namespace gr {
     void step()
     {
       phase += phase_inc;
-      if(fabs(phase) > M_PI) {
-        while(phase > M_PI)
-          phase -= 2*M_PI;
+      if(fabs(phase) > GR_M_PI) {
+        while(phase > GR_M_PI)
+          phase -= 2*GR_M_PI;
 
-        while(phase < -M_PI)
-          phase += 2*M_PI;
+        while(phase < -GR_M_PI)
+          phase += 2*GR_M_PI;
       }
     }
 
     void step(int n)
     {
       phase += phase_inc * n;
-      if(fabs(phase) > M_PI){
-        while(phase > M_PI)
-          phase -= 2*M_PI;
+      if(fabs(phase) > GR_M_PI){
+        while(phase > GR_M_PI)
+          phase -= 2*GR_M_PI;
 
-        while(phase < -M_PI)
-          phase += 2*M_PI;
+        while(phase < -GR_M_PI)
+          phase += 2*GR_M_PI;
       }
     }
 
diff --git a/gnuradio-runtime/lib/math/qa_fxpt.cc b/gnuradio-runtime/lib/math/qa_fxpt.cc
index d3aadf85b1..5b045a69a1 100644
--- a/gnuradio-runtime/lib/math/qa_fxpt.cc
+++ b/gnuradio-runtime/lib/math/qa_fxpt.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004,2013 Free Software Foundation, Inc.
+ * Copyright 2004,2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -26,6 +26,7 @@
 
 #include <qa_fxpt.h>
 #include <gnuradio/fxpt.h>
+#include <gnuradio/math.h>
 #include <cppunit/TestAssert.h>
 #include <iostream>
 #include <stdio.h>
@@ -37,9 +38,9 @@ static const float SIN_COS_TOLERANCE = 1e-5;
 void
 qa_fxpt::t0()
 {
-  CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI/2, gr::fxpt::fixed_to_float(0x40000000), SIN_COS_TOLERANCE);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(GR_M_PI/2, gr::fxpt::fixed_to_float(0x40000000), SIN_COS_TOLERANCE);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0,    gr::fxpt::fixed_to_float(0x00000000), SIN_COS_TOLERANCE);
-  CPPUNIT_ASSERT_DOUBLES_EQUAL(-M_PI,  gr::fxpt::fixed_to_float(0x80000000), SIN_COS_TOLERANCE);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-GR_M_PI,  gr::fxpt::fixed_to_float(0x80000000), SIN_COS_TOLERANCE);
 
   if(0) {
     /*
@@ -51,9 +52,9 @@ qa_fxpt::t0()
      * sometimes the answer is off by a few bits at the bottom.
      * Hence, the disabled check.
      */
-    CPPUNIT_ASSERT_EQUAL((int32_t)0x40000000, gr::fxpt::float_to_fixed(M_PI/2));
+    CPPUNIT_ASSERT_EQUAL((int32_t)0x40000000, gr::fxpt::float_to_fixed(GR_M_PI/2));
     CPPUNIT_ASSERT_EQUAL((int32_t)0,          gr::fxpt::float_to_fixed(0));
-    CPPUNIT_ASSERT_EQUAL((int32_t)0x80000000, gr::fxpt::float_to_fixed(-M_PI));
+    CPPUNIT_ASSERT_EQUAL((int32_t)0x80000000, gr::fxpt::float_to_fixed(-GR_M_PI));
   }
 }
 
@@ -70,7 +71,7 @@ qa_fxpt::t1()
   CPPUNIT_ASSERT_DOUBLES_EQUAL(-1,           gr::fxpt::sin(-0x40000000), SIN_COS_TOLERANCE);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.707106781, gr::fxpt::sin(-0x20000000), SIN_COS_TOLERANCE);
 
-  for(float p = -M_PI; p < M_PI; p += 2 * M_PI / 3600) {
+  for(float p = -GR_M_PI; p < GR_M_PI; p += 2 * GR_M_PI / 3600) {
     float expected = sin(p);
     float actual = gr::fxpt::sin(gr::fxpt::float_to_fixed (p));
     CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actual, SIN_COS_TOLERANCE);
@@ -80,7 +81,7 @@ qa_fxpt::t1()
 void
 qa_fxpt::t2()
 {
-  for(float p = -M_PI; p < M_PI; p += 2 * M_PI / 3600) {
+  for(float p = -GR_M_PI; p < GR_M_PI; p += 2 * GR_M_PI / 3600) {
     float expected = cos(p);
     float actual = gr::fxpt::cos(gr::fxpt::float_to_fixed(p));
     CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actual, SIN_COS_TOLERANCE);
@@ -90,7 +91,7 @@ qa_fxpt::t2()
 void
 qa_fxpt::t3()
 {
-  for(float p = -M_PI; p < M_PI; p += 2 * M_PI / 3600) {
+  for(float p = -GR_M_PI; p < GR_M_PI; p += 2 * GR_M_PI / 3600) {
     float expected_sin = sin(p);
     float expected_cos = cos(p);
     float actual_sin;
diff --git a/gnuradio-runtime/lib/math/qa_fxpt_nco.cc b/gnuradio-runtime/lib/math/qa_fxpt_nco.cc
index 16ea120381..0b1ef16dd9 100644
--- a/gnuradio-runtime/lib/math/qa_fxpt_nco.cc
+++ b/gnuradio-runtime/lib/math/qa_fxpt_nco.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004,2013 Free Software Foundation, Inc.
+ * Copyright 2004,2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -27,6 +27,8 @@
 #include <qa_fxpt_nco.h>
 #include <gnuradio/fxpt_nco.h>
 #include <gnuradio/nco.h>
+#include <gnuradio/math.h>
+
 #include <cppunit/TestAssert.h>
 #include <iostream>
 #include <stdio.h>
@@ -52,8 +54,8 @@ qa_fxpt_nco::t0()
   gr::fxpt_nco		new_nco;
   double max_error = 0, max_phase_error = 0;
 
-  ref_nco.set_freq((float)(2 * M_PI / SIN_COS_FREQ));
-  new_nco.set_freq((float)(2 * M_PI / SIN_COS_FREQ));
+  ref_nco.set_freq((float)(2 * GR_M_PI / SIN_COS_FREQ));
+  new_nco.set_freq((float)(2 * GR_M_PI / SIN_COS_FREQ));
 
   CPPUNIT_ASSERT_DOUBLES_EQUAL(ref_nco.get_freq(), new_nco.get_freq(), SIN_COS_TOLERANCE);
 
@@ -90,8 +92,8 @@ qa_fxpt_nco::t1()
   gr_complex*		new_block = new gr_complex[SIN_COS_BLOCK_SIZE];
   double max_error = 0;
 
-  ref_nco.set_freq((float)(2 * M_PI / SIN_COS_FREQ));
-  new_nco.set_freq((float)(2 * M_PI / SIN_COS_FREQ));
+  ref_nco.set_freq((float)(2 * GR_M_PI / SIN_COS_FREQ));
+  new_nco.set_freq((float)(2 * GR_M_PI / SIN_COS_FREQ));
 
   CPPUNIT_ASSERT_DOUBLES_EQUAL(ref_nco.get_freq(), new_nco.get_freq(), SIN_COS_TOLERANCE);
 
diff --git a/gnuradio-runtime/lib/math/random.cc b/gnuradio-runtime/lib/math/random.cc
index 5ebe174914..152db77b78 100644
--- a/gnuradio-runtime/lib/math/random.cc
+++ b/gnuradio-runtime/lib/math/random.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2002, 2015 Free Software Foundation, Inc.
+ * Copyright 2002,2015,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -39,8 +39,10 @@
 #include <config.h>
 #endif
 
-#include <math.h>
 #include <gnuradio/random.h>
+#include <gnuradio/math.h>
+
+#include <cmath>
 
 namespace gr {
 
diff --git a/gnuradio-runtime/lib/math/vco.h b/gnuradio-runtime/lib/math/vco.h
index d8a6fbb415..7ac1e1ca6d 100644
--- a/gnuradio-runtime/lib/math/vco.h
+++ b/gnuradio-runtime/lib/math/vco.h
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2005,2013 Free Software Foundation, Inc.
+ * Copyright 2005,2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -25,6 +25,8 @@
 
 #include <gnuradio/sincos.h>
 #include <gnuradio/gr_complex.h>
+#include <gnuradio/math.h>
+
 #include <vector>
 #include <cmath>
 
@@ -49,13 +51,13 @@ namespace gr {
 
     void adjust_phase(double delta_phase) {
       d_phase += delta_phase;
-      if(fabs (d_phase) > M_PI){
+      if(fabs (d_phase) > GR_M_PI){
 
-        while(d_phase > M_PI)
-          d_phase -= 2*M_PI;
+        while(d_phase > GR_M_PI)
+          d_phase -= 2*GR_M_PI;
 
-        while(d_phase < -M_PI)
-          d_phase += 2*M_PI;
+        while(d_phase < -GR_M_PI)
+          d_phase += 2*GR_M_PI;
       }
     }
 
diff --git a/gr-analog/lib/cpfsk_bc_impl.cc b/gr-analog/lib/cpfsk_bc_impl.cc
index 3c1674aaa4..01b3ae3ebd 100644
--- a/gr-analog/lib/cpfsk_bc_impl.cc
+++ b/gr-analog/lib/cpfsk_bc_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2008,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2008,2010,2012,2018 Free Software Foundation, Inc.
  *
  * GNU Radio is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,12 +25,11 @@
 #include "cpfsk_bc_impl.h"
 #include <gnuradio/io_signature.h>
 #include <gnuradio/expj.h>
+#include <gnuradio/math.h>
 
 namespace gr {
   namespace analog {
 
-#define M_TWOPI (2*M_PI)
-
     cpfsk_bc::sptr
     cpfsk_bc::make(float k, float ampl, int samples_per_sym)
     {
@@ -45,7 +44,7 @@ namespace gr {
 			     samples_per_sym)
     {
       d_samples_per_sym = samples_per_sym;
-      d_freq = k*M_PI/samples_per_sym;
+      d_freq = k*GR_M_PI/samples_per_sym;
       d_ampl = ampl;
       d_phase = 0.0;
     }
@@ -69,10 +68,10 @@ namespace gr {
 	  else
 	    d_phase -= d_freq;
 
-	  while(d_phase > M_TWOPI)
-	    d_phase -= M_TWOPI;
-	  while(d_phase < -M_TWOPI)
-	    d_phase += M_TWOPI;
+	  while(d_phase > GR_M_TWOPI)
+	    d_phase -= GR_M_TWOPI;
+	  while(d_phase < -GR_M_TWOPI)
+	    d_phase += GR_M_TWOPI;
 
 	  *out++ = gr_expj(d_phase)*d_ampl;
 	}
diff --git a/gr-analog/lib/cpm.cc b/gr-analog/lib/cpm.cc
index b61ee28816..a9eb7921d2 100644
--- a/gr-analog/lib/cpm.cc
+++ b/gr-analog/lib/cpm.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2010,2012 Free Software Foundation, Inc.
+ * Copyright 2010,2012,2018 Free Software Foundation, Inc.
  *
  * GNU Radio is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,10 +24,11 @@
 #include "config.h"
 #endif
 
-#include <cmath>
-#include <cfloat>
 #include <gnuradio/analog/cpm.h>
+#include <gnuradio/math.h>
 
+#include <cmath>
+#include <cfloat>
 //gives us erf on compilers without it
 #include <boost/math/special_functions/erf.hpp>
 namespace bm = boost::math;
@@ -35,10 +36,6 @@ namespace bm = boost::math;
 namespace gr {
   namespace analog {
 
-#ifndef M_TWOPI
-#  define M_TWOPI (2*M_PI)
-#endif
-
     //! Normalised sinc function, sinc(x)=sin(pi*x)/pi*x
     inline double
     sinc(double x)
@@ -46,7 +43,7 @@ namespace gr {
       if(x == 0) {
 	return 1.0;
       }
-      return sin(M_PI * x) / (M_PI * x);
+      return sin(GR_M_PI * x) / (GR_M_PI * x);
     }
 
 
@@ -56,7 +53,7 @@ namespace gr {
     {
       std::vector<float> taps(samples_per_sym * L, 1.0/L/samples_per_sym);
       for(unsigned i = 0; i < samples_per_sym * L; i++) {
-	taps[i] *= 1 - cos(M_TWOPI * i / L / samples_per_sym);
+	taps[i] *= 1 - cos(GR_M_TWOPI * i / L / samples_per_sym);
       }
 
       return taps;
@@ -96,11 +93,11 @@ namespace gr {
 	// and the whole thing converges to PI/4 (to prove this, use de
 	// l'hopital's rule).
 	if(fabs(fabs(k) - Ls/4/beta) < 2*DBL_EPSILON) {
-	  taps_d[i] *= M_PI_4;
+	  taps_d[i] *= GR_M_PI_4;
 	}
 	else {
 	  double tmp = 4.0 * beta * k / Ls;
-	  taps_d[i] *= cos(beta * M_TWOPI * k / Ls) / (1 - tmp * tmp);
+	  taps_d[i] *= cos(beta * GR_M_TWOPI * k / Ls) / (1 - tmp * tmp);
 	}
 	sum += taps_d[i];
       }
@@ -127,7 +124,7 @@ namespace gr {
       }
 
       const double pi2_24 = 0.411233516712057; // pi^2/24
-      double f = M_PI * k / sps;
+      double f = GR_M_PI * k / sps;
       return sinc(k/sps) - pi2_24 * (2 * sin(f) - 2*f*cos(f) - f*f*sin(f)) / (f*f*f);
     }
 
diff --git a/gr-analog/lib/fmdet_cf_impl.cc b/gr-analog/lib/fmdet_cf_impl.cc
index 38496d189b..5151f027d4 100644
--- a/gr-analog/lib/fmdet_cf_impl.cc
+++ b/gr-analog/lib/fmdet_cf_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2008,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2008,2010,2012,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -31,7 +31,7 @@
 namespace gr {
   namespace analog {
 
-#define M_TWOPI (2*M_PI)
+#define M_TWOPI (2*GR_M_PI)
 
     fmdet_cf::sptr
     fmdet_cf::make(float samplerate, float freq_low,
diff --git a/gr-analog/lib/frequency_modulator_fc_impl.cc b/gr-analog/lib/frequency_modulator_fc_impl.cc
index 56fa0f7c17..0c7f9873b1 100644
--- a/gr-analog/lib/frequency_modulator_fc_impl.cc
+++ b/gr-analog/lib/frequency_modulator_fc_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004,2010-2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010-2012,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -27,6 +27,7 @@
 #include "frequency_modulator_fc_impl.h"
 #include <gnuradio/io_signature.h>
 #include <gnuradio/fxpt.h>
+#include <gnuradio/math.h>
 #include <cmath>
 
 namespace gr {
@@ -63,7 +64,7 @@ namespace gr {
 	d_phase = d_phase + d_sensitivity * in[i];
 
 	//place phase in [-pi, +pi[
-	#define F_PI ((float)(M_PI))
+	#define F_PI ((float)(GR_M_PI))
 	d_phase   = std::fmod(d_phase + F_PI, 2.0f * F_PI) - F_PI;
 
 	float oi, oq;
diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.cc b/gr-analog/lib/pll_carriertracking_cc_impl.cc
index 0cc3f8b8ec..bf8b219189 100644
--- a/gr-analog/lib/pll_carriertracking_cc_impl.cc
+++ b/gr-analog/lib/pll_carriertracking_cc_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2006,2010-2013 Free Software Foundation, Inc.
+ * Copyright 2006,2010-2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -27,16 +27,13 @@
 #include "pll_carriertracking_cc_impl.h"
 #include <gnuradio/io_signature.h>
 #include <gnuradio/sincos.h>
-#include <math.h>
 #include <gnuradio/math.h>
 
+#include <cmath>
+
 namespace gr {
   namespace analog {
 
-#ifndef M_TWOPI
-#define M_TWOPI (2.0f*M_PI)
-#endif
-
     pll_carriertracking_cc::sptr
     pll_carriertracking_cc::make(float loop_bw, float max_freq, float min_freq)
     {
@@ -62,10 +59,10 @@ namespace gr {
     float
     pll_carriertracking_cc_impl::mod_2pi(float in)
     {
-      if(in>M_PI)
-	return in-M_TWOPI;
-      else if(in<-M_PI)
-	return in+M_TWOPI;
+      if(in>GR_M_PI)
+	return in-GR_M_TWOPI;
+      else if(in<-GR_M_PI)
+	return in+GR_M_TWOPI;
       else
 	return in;
     }
diff --git a/gr-analog/lib/pll_freqdet_cf_impl.cc b/gr-analog/lib/pll_freqdet_cf_impl.cc
index 42caa0bfd5..46c9a9f954 100644
--- a/gr-analog/lib/pll_freqdet_cf_impl.cc
+++ b/gr-analog/lib/pll_freqdet_cf_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004,2010,2011 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2011,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -26,16 +26,13 @@
 
 #include "pll_freqdet_cf_impl.h"
 #include <gnuradio/io_signature.h>
-#include <math.h>
 #include <gnuradio/math.h>
 
+#include <cmath>
+
 namespace gr {
   namespace analog {
 
-#ifndef M_TWOPI
-#define M_TWOPI (2.0f*M_PI)
-#endif
-
     pll_freqdet_cf::sptr
     pll_freqdet_cf::make(float loop_bw, float max_freq, float min_freq)
     {
@@ -58,10 +55,10 @@ namespace gr {
     float
     pll_freqdet_cf_impl::mod_2pi(float in)
     {
-      if(in > M_PI)
-	return in - M_TWOPI;
-      else if(in < -M_PI)
-	return in + M_TWOPI;
+      if(in > GR_M_PI)
+	return in - GR_M_TWOPI;
+      else if(in < -GR_M_PI)
+	return in + GR_M_TWOPI;
       else
 	return in;
     }
diff --git a/gr-analog/lib/pll_refout_cc_impl.cc b/gr-analog/lib/pll_refout_cc_impl.cc
index 4822263a9c..4cf3574bc7 100644
--- a/gr-analog/lib/pll_refout_cc_impl.cc
+++ b/gr-analog/lib/pll_refout_cc_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004,2010-2013 Free Software Foundation, Inc.
+ * Copyright 2004,2010-2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -33,10 +33,6 @@
 namespace gr {
   namespace analog {
 
-#ifndef M_TWOPI
-#define M_TWOPI (2.0f*M_PI)
-#endif
-
     pll_refout_cc::sptr
     pll_refout_cc::make(float loop_bw, float max_freq, float min_freq)
     {
@@ -59,10 +55,10 @@ namespace gr {
     float
     pll_refout_cc_impl::mod_2pi(float in)
     {
-      if(in > M_PI)
-	return in - M_TWOPI;
-      else if(in < -M_PI)
-	return in+ M_TWOPI;
+      if(in > GR_M_PI)
+	return in - GR_M_TWOPI;
+      else if(in < -GR_M_PI)
+	return in+ GR_M_TWOPI;
       else
 	return in;
     }
diff --git a/gr-analog/lib/sig_source_X_impl.cc.t b/gr-analog/lib/sig_source_X_impl.cc.t
index 017177eae0..18a45f5801 100644
--- a/gr-analog/lib/sig_source_X_impl.cc.t
+++ b/gr-analog/lib/sig_source_X_impl.cc.t
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -27,11 +27,12 @@
 #endif
 
 #include "@IMPL_NAME@.h"
-#include <algorithm>
 #include <gnuradio/io_signature.h>
+#include <gnuradio/gr_complex.h>
+#include <gnuradio/math.h>
+
 #include <stdexcept>
 #include <algorithm>
-#include <gnuradio/gr_complex.h>
 
 namespace gr {
   namespace analog {
@@ -125,11 +126,11 @@ namespace gr {
 	 */
       case GR_SQR_WAVE:
 	for(int i = 0; i < noutput_items; i++) {
-	  if(d_nco.get_phase() < -1*M_PI/2)
+	  if(d_nco.get_phase() < -1*GR_M_PI/2)
 	    optr[i] = gr_complex(d_ampl, 0) + d_offset;
 	  else if(d_nco.get_phase() < 0)
 	    optr[i] = gr_complex(d_ampl, d_ampl) + d_offset;
-	  else if(d_nco.get_phase() < M_PI/2)
+	  else if(d_nco.get_phase() < GR_M_PI/2)
 	    optr[i] = gr_complex(0, d_ampl) + d_offset;
 	  else
 	    optr[i] = d_offset;
@@ -143,21 +144,21 @@ namespace gr {
 	 */
       case GR_TRI_WAVE:
 	for(int i = 0; i < noutput_items; i++) {
-	  if(d_nco.get_phase() < -1*M_PI/2){
-	    optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl,
-		 -1*d_ampl*d_nco.get_phase()/M_PI - d_ampl/2) + d_offset;
+	  if(d_nco.get_phase() < -1*GR_M_PI/2){
+	    optr[i] = gr_complex(d_ampl*d_nco.get_phase()/GR_M_PI + d_ampl,
+		 -1*d_ampl*d_nco.get_phase()/GR_M_PI - d_ampl/2) + d_offset;
 	  }
 	  else if(d_nco.get_phase() < 0) {
-	    optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl,
-		 d_ampl*d_nco.get_phase()/M_PI + d_ampl/2) + d_offset;
+	    optr[i] = gr_complex(d_ampl*d_nco.get_phase()/GR_M_PI + d_ampl,
+		 d_ampl*d_nco.get_phase()/GR_M_PI + d_ampl/2) + d_offset;
 	  }
-	  else if(d_nco.get_phase() < M_PI/2) {
-	    optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl,
-		 d_ampl*d_nco.get_phase()/M_PI + d_ampl/2) + d_offset;
+	  else if(d_nco.get_phase() < GR_M_PI/2) {
+	    optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/GR_M_PI + d_ampl,
+		 d_ampl*d_nco.get_phase()/GR_M_PI + d_ampl/2) + d_offset;
 	  }
 	  else {
-	    optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl,
-		 -1*d_ampl*d_nco.get_phase()/M_PI + 3*d_ampl/2) + d_offset;
+	    optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/GR_M_PI + d_ampl,
+		 -1*d_ampl*d_nco.get_phase()/GR_M_PI + 3*d_ampl/2) + d_offset;
 	  }
 	  d_nco.step();
 	}
@@ -168,13 +169,13 @@ namespace gr {
 	 */
       case GR_SAW_WAVE:
 	for(int i = 0; i < noutput_items; i++) {
-	  if(d_nco.get_phase() < -1*M_PI/2) {
-	    optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2,
-		 d_ampl*d_nco.get_phase()/(2*M_PI) + 5*d_ampl/4) + d_offset;
+	  if(d_nco.get_phase() < -1*GR_M_PI/2) {
+	    optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*GR_M_PI) + d_ampl/2,
+		 d_ampl*d_nco.get_phase()/(2*GR_M_PI) + 5*d_ampl/4) + d_offset;
 	  }
 	  else {
-	    optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2,
-		 d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/4) + d_offset;
+	    optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*GR_M_PI) + d_ampl/2,
+		 d_ampl*d_nco.get_phase()/(2*GR_M_PI) + d_ampl/4) + d_offset;
 	  }
 	  d_nco.step();
 	}
@@ -222,7 +223,7 @@ namespace gr {
 	/* The triangle wave rises from -PI to 0 and falls from 0 to PI. */
       case GR_TRI_WAVE:
 	for(int i = 0; i < noutput_items; i++) {
-	  double t = d_ampl*d_nco.get_phase()/M_PI;
+	  double t = d_ampl*d_nco.get_phase()/GR_M_PI;
 	  if (d_nco.get_phase() < 0)
 	    optr[i] = static_cast<@TYPE@>(t + d_ampl + d_offset);
 	  else
@@ -234,7 +235,7 @@ namespace gr {
 	/* The saw tooth wave rises from -PI to PI. */
       case GR_SAW_WAVE:
 	for(int i = 0; i < noutput_items; i++) {
-	  t = static_cast<@TYPE@>(d_ampl*d_nco.get_phase()/(2*M_PI)
+	  t = static_cast<@TYPE@>(d_ampl*d_nco.get_phase()/(2*GR_M_PI)
 				  + d_ampl/2 + d_offset);
 	  optr[i] = t;
 	  d_nco.step();
@@ -254,7 +255,7 @@ namespace gr {
     @NAME@::set_sampling_freq(double sampling_freq)
     {
       d_sampling_freq = sampling_freq;
-      d_nco.set_freq (2 * M_PI * d_frequency / d_sampling_freq);
+      d_nco.set_freq (2 * GR_M_PI * d_frequency / d_sampling_freq);
     }
 
     void
@@ -267,7 +268,7 @@ namespace gr {
     @NAME@::set_frequency(double frequency)
     {
       d_frequency = frequency;
-      d_nco.set_freq(2 * M_PI * d_frequency / d_sampling_freq);
+      d_nco.set_freq(2 * GR_M_PI * d_frequency / d_sampling_freq);
     }
 
     void
diff --git a/gr-analog/lib/squelch_base_cc_impl.cc b/gr-analog/lib/squelch_base_cc_impl.cc
index b5c153558b..0873d81acc 100644
--- a/gr-analog/lib/squelch_base_cc_impl.cc
+++ b/gr-analog/lib/squelch_base_cc_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004,2006,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2012,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -26,6 +26,7 @@
 
 #include "squelch_base_cc_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
 
 namespace gr {
   namespace analog {
@@ -120,7 +121,7 @@ namespace gr {
             break;
 
           case ST_ATTACK:
-            d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
+            d_envelope = 0.5-std::cos(GR_M_PI*(++d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
             if(d_ramped >= d_ramp) { // use >= in case d_ramp is set to lower value elsewhere
               d_state = ST_UNMUTED;
               d_tag_next_unmuted = true;
@@ -129,7 +130,7 @@ namespace gr {
             break;
 
           case ST_DECAY:
-            d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
+            d_envelope = 0.5-std::cos(GR_M_PI*(--d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
             if(d_ramped == 0.0) {
               d_state = ST_MUTED;
               add_item_tag(0, nitems_written(0) + j, d_eob_key, pmt::PMT_NIL);
diff --git a/gr-analog/lib/squelch_base_ff_impl.cc b/gr-analog/lib/squelch_base_ff_impl.cc
index ea2d29bd97..2f164be363 100644
--- a/gr-analog/lib/squelch_base_ff_impl.cc
+++ b/gr-analog/lib/squelch_base_ff_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004,2006,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2012,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -26,6 +26,7 @@
 
 #include "squelch_base_ff_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
 #include <pmt/pmt.h>
 
 namespace gr {
@@ -120,7 +121,7 @@ namespace gr {
 
           case ST_ATTACK:
             // FIXME: precalculate window for speed
-            d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0;
+            d_envelope = 0.5-std::cos(GR_M_PI*(++d_ramped)/d_ramp)/2.0;
 
             // use >= in case d_ramp is set to lower value elsewhere
             if(d_ramped >= d_ramp) {
@@ -132,7 +133,7 @@ namespace gr {
 
           case ST_DECAY:
             // FIXME: precalculate window for speed
-            d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0;
+            d_envelope = 0.5-std::cos(GR_M_PI*(--d_ramped)/d_ramp)/2.0;
             if(d_ramped == 0.0) {
               d_state = ST_MUTED;
               add_item_tag(0, nitems_written(0) + j, d_eob_key, pmt::PMT_NIL);
diff --git a/gr-blocks/lib/control_loop.cc b/gr-blocks/lib/control_loop.cc
index 7104e7439e..30260b5646 100644
--- a/gr-blocks/lib/control_loop.cc
+++ b/gr-blocks/lib/control_loop.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2011,2013 Free Software Foundation, Inc.
+ * Copyright 2011,2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -31,7 +31,7 @@
 namespace gr {
   namespace blocks {
 
-#define M_TWOPI (2.0f*M_PI)
+#define M_TWOPI (2.0f*GR_M_PI)
 
     control_loop::control_loop(float loop_bw,
                                float max_freq, float min_freq)
diff --git a/gr-blocks/lib/qa_rotator.cc b/gr-blocks/lib/qa_rotator.cc
index c63d150113..829d6e26eb 100644
--- a/gr-blocks/lib/qa_rotator.cc
+++ b/gr-blocks/lib/qa_rotator.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2002,2013 Free Software Foundation, Inc.
+ * Copyright 2002,2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -24,13 +24,16 @@
 #include <config.h>
 #endif
 
+#include <qa_rotator.h>
+
 #include <gnuradio/attributes.h>
 #include <cppunit/TestAssert.h>
-#include <qa_rotator.h>
 #include <gnuradio/blocks/rotator.h>
-#include <stdio.h>
-#include <cmath>
 #include <gnuradio/expj.h>
+#include <gnuradio/math.h>
+
+#include <cstdio>
+#include <cmath>
 
 // error vector magnitude
 __GR_ATTR_UNUSED static float
@@ -46,7 +49,7 @@ qa_rotator::t1()
 
   gr::blocks::rotator r;
 
-  double phase_incr = 2*M_PI / 1003;
+  double phase_incr = 2*GR_M_PI / 1003;
   double phase = 0;
 
   // Old code: We increment then return the rotated value, thus we
@@ -69,8 +72,8 @@ qa_rotator::t1()
     CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, 0.0001);
 
     phase += phase_incr;
-    if(phase >= 2*M_PI)
-      phase -= 2*M_PI;
+    if(phase >= 2*GR_M_PI)
+      phase -= 2*GR_M_PI;
   }
 }
 
@@ -83,7 +86,7 @@ qa_rotator::t2()
   gr_complex *input  = new gr_complex[N];
   gr_complex *output = new gr_complex[N];
 
-  double phase_incr = 2*M_PI / 1003;
+  double phase_incr = 2*GR_M_PI / 1003;
   double phase = 0;
 
   r.set_phase(gr_complex(1,0));
@@ -110,8 +113,8 @@ qa_rotator::t2()
     CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, 0.0001);
 
     phase += phase_incr;
-    if(phase >= 2*M_PI)
-      phase -= 2*M_PI;
+    if(phase >= 2*GR_M_PI)
+      phase -= 2*GR_M_PI;
   }
 
   delete[] output;
diff --git a/gr-blocks/tests/benchmark_nco.cc b/gr-blocks/tests/benchmark_nco.cc
index a71d6f3b4d..ac172bf79d 100644
--- a/gr-blocks/tests/benchmark_nco.cc
+++ b/gr-blocks/tests/benchmark_nco.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2002,2004,2013 Free Software Foundation, Inc.
+ * Copyright 2002,2004,2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -24,18 +24,20 @@
 #include "config.h"
 #endif
 
-#include <stdio.h>
-#include <stdlib.h>
+#include <gnuradio/nco.h>
+#include <gnuradio/fxpt_nco.h>
+#include <gnuradio/math.h>
+
 #include <sys/time.h>
+#include <unistd.h>
 
 #ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
 #endif
 
-#include <unistd.h>
-#include <gnuradio/nco.h>
-#include <gnuradio/fxpt_nco.h>
-#include <string.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 
 #define ITERATIONS 20000000
 #define BLOCK_SIZE (10 * 1000)	// fits in cache
@@ -114,7 +116,7 @@ void basic_sincos_vec(float *x, float *y)
 {
   gr::blocks::nco<float,float> nco;
 
-  nco.set_freq(2 * M_PI / FREQ);
+  nco.set_freq(2 * GR_M_PI / FREQ);
 
   for(int i = 0; i < ITERATIONS/BLOCK_SIZE; i++) {
     for(int j = 0; j < BLOCK_SIZE; j++) {
@@ -128,7 +130,7 @@ void native_sincos_vec(float *x, float *y)
 {
   gr::blocks::nco<float,float> nco;
 
-  nco.set_freq(2 * M_PI / FREQ);
+  nco.set_freq(2 * GR_M_PI / FREQ);
 
   for(int i = 0; i < ITERATIONS/BLOCK_SIZE; i++) {
     nco.sincos((gr_complex*)x, BLOCK_SIZE);
@@ -139,7 +141,7 @@ void fxpt_sincos_vec(float *x, float *y)
 {
   gr::blocks::fxpt_nco nco;
 
-  nco.set_freq (2 * M_PI / FREQ);
+  nco.set_freq (2 * GR_M_PI / FREQ);
 
   for(int i = 0; i < ITERATIONS/BLOCK_SIZE; i++) {
     nco.sincos((gr_complex*)x, BLOCK_SIZE);
@@ -152,7 +154,7 @@ void native_sincos(float *x, float *y)
 {
   gr::blocks::nco<float,float> nco;
 
-  nco.set_freq(2 * M_PI / FREQ);
+  nco.set_freq(2 * GR_M_PI / FREQ);
 
   for(int i = 0; i < ITERATIONS; i++) {
     nco.sincos(x, y);
@@ -164,7 +166,7 @@ void fxpt_sincos(float *x, float *y)
 {
   gr::blocks::fxpt_nco nco;
 
-  nco.set_freq(2 * M_PI / FREQ);
+  nco.set_freq(2 * GR_M_PI / FREQ);
 
   for(int i = 0; i < ITERATIONS; i++) {
     nco.sincos(x, y);
@@ -178,7 +180,7 @@ void native_sin(float *x, float *y)
 {
   gr::blocks::nco<float,float> nco;
 
-  nco.set_freq(2 * M_PI / FREQ);
+  nco.set_freq(2 * GR_M_PI / FREQ);
 
   for(int i = 0; i < ITERATIONS; i++) {
     *x = nco.sin();
@@ -190,7 +192,7 @@ void fxpt_sin(float *x, float *y)
 {
   gr::blocks::fxpt_nco nco;
 
-  nco.set_freq(2 * M_PI / FREQ);
+  nco.set_freq(2 * GR_M_PI / FREQ);
 
   for(int i = 0; i < ITERATIONS; i++) {
     *x = nco.sin();
diff --git a/gr-blocks/tests/benchmark_vco.cc b/gr-blocks/tests/benchmark_vco.cc
index a5eb19a416..5c5aad30fc 100644
--- a/gr-blocks/tests/benchmark_vco.cc
+++ b/gr-blocks/tests/benchmark_vco.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2002,2004,2005,2013 Free Software Foundation, Inc.
+ * Copyright 2002,2004,2005,2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -24,18 +24,20 @@
 #include "config.h"
 #endif
 
-#include <stdio.h>
-#include <stdlib.h>
+#include <gnuradio/vco.h>
+#include <gnuradio/fxpt_vco.h>
+#include <gnuradio/math.h>
+
 #include <sys/time.h>
+#include <unistd.h>
 
 #ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
 #endif
 
-#include <unistd.h>
-#include <gnuradio/vco.h>
-#include <gnuradio/fxpt_vco.h>
-#include <string.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 
 #define ITERATIONS 5000000
 #define BLOCK_SIZE (10 * 1000)	// fits in cache
@@ -122,11 +124,11 @@ void basic_vco(float *output, const float *input)
       output[i] = cos(phase) * AMPLITUDE;
       phase += input[i] * K;
 
-      while(phase > 2 * M_PI)
-	phase -= 2 * M_PI;
+      while(phase > 2 * GR_M_PI)
+	phase -= 2 * GR_M_PI;
 
-      while(phase < -2 * M_PI)
-	phase += 2 * M_PI;
+      while(phase < -2 * GR_M_PI)
+	phase += 2 * GR_M_PI;
     }
   }
 }
diff --git a/gr-channels/lib/cfo_model_impl.cc b/gr-channels/lib/cfo_model_impl.cc
index 81d2c59fb1..8b3d069323 100644
--- a/gr-channels/lib/cfo_model_impl.cc
+++ b/gr-channels/lib/cfo_model_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2009,2012 Free Software Foundation, Inc.
+ * Copyright 2009,2012,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -22,6 +22,7 @@
 
 #include "cfo_model_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
 #include <iostream>
 
 namespace gr {
@@ -77,9 +78,9 @@ namespace gr {
             d_cfo = std::min( d_cfo, d_max_dev_hz );
             d_cfo = std::max( d_cfo, -d_max_dev_hz );
             // update and wrap angle
-            d_angle += 2*M_PI*d_cfo/d_samp_rate;
-            d_angle = d_angle > 2*M_PI ? d_angle - 2*M_PI : d_angle;
-            d_angle = d_angle < -2*M_PI ? d_angle + 2*M_PI : d_angle;
+            d_angle += 2*GR_M_PI*d_cfo/d_samp_rate;
+            d_angle = d_angle > 2*GR_M_PI ? d_angle - 2*GR_M_PI : d_angle;
+            d_angle = d_angle < -2*GR_M_PI ? d_angle + 2*GR_M_PI : d_angle;
             out[i] = in[i] * gr_complex(d_table.cos(d_angle), d_table.sin(d_angle));
         }
         return noutput_items;
diff --git a/gr-channels/lib/channel_model2_impl.cc b/gr-channels/lib/channel_model2_impl.cc
index 59524fb83a..d548244ea0 100644
--- a/gr-channels/lib/channel_model2_impl.cc
+++ b/gr-channels/lib/channel_model2_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2009,2012,2013 Free Software Foundation, Inc.
+ * Copyright 2009,2012,2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -20,10 +20,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
- #define _USE_MATH_DEFINES
-
 #include "channel_model2_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
 #include <iostream>
 
 namespace gr {
@@ -66,7 +65,7 @@ namespace gr {
       d_noise_adder = blocks::add_cc::make();
       d_noise = analog::fastnoise_source_c::make(analog::GR_GAUSSIAN,
 						 noise_voltage, noise_seed);
-      d_freq_gen = blocks::vco_c::make(1.0, 2*M_PI, 1.0);
+      d_freq_gen = blocks::vco_c::make(1.0, 2*GR_M_PI, 1.0);
 
       d_mixer_offset = blocks::multiply_cc::make();
 
diff --git a/gr-channels/lib/flat_fader_impl.cc b/gr-channels/lib/flat_fader_impl.cc
index 47834175f3..ee84d8b7b9 100644
--- a/gr-channels/lib/flat_fader_impl.cc
+++ b/gr-channels/lib/flat_fader_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2016 Free Software Foundation, Inc.
+ * Copyright 2016,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -21,13 +21,14 @@
  */
 
 #include <flat_fader_impl.h>
+#include <gnuradio/math.h>
 
 namespace gr {
   namespace channels {
 
     flat_fader_impl::flat_fader_impl(unsigned int N, float fDTs, bool LOS, float K, int seed ) :
         seed_1((int)seed),
-        dist_1(-M_PI, M_PI),
+        dist_1(-GR_M_PI, GR_M_PI),
         rv_1( seed_1, dist_1 ), // U(-pi,pi)
 
         seed_2((int)seed+1),
@@ -75,16 +76,16 @@ namespace gr {
         for(int i = 0; i < n_samples; i++){
             gr_complex H(0,0);
             for(int n=1; n<d_N+1; n++){
-                float alpha_n = (2*M_PI*n - M_PI + d_theta)/(4*d_N);
-                d_psi[n] = fmod(d_psi[n] + 2*M_PI*d_fDTs*_GRFASTCOS(alpha_n), 2*M_PI);
-                d_phi[n] = fmod(d_phi[n] + 2*M_PI*d_fDTs*_GRFASTCOS(alpha_n), 2*M_PI);
+                float alpha_n = (2*GR_M_PI*n - GR_M_PI + d_theta)/(4*d_N);
+                d_psi[n] = fmod(d_psi[n] + 2*GR_M_PI*d_fDTs*_GRFASTCOS(alpha_n), 2*GR_M_PI);
+                d_phi[n] = fmod(d_phi[n] + 2*GR_M_PI*d_fDTs*_GRFASTCOS(alpha_n), 2*GR_M_PI);
                 float s_i = scale_sin*_GRFASTCOS(d_psi[n]);
                 float s_q = scale_sin*_GRFASTSIN(d_phi[n]);
                 H += gr_complex(s_i, s_q);
                 }
     
             if(d_LOS){
-                d_psi[0] = fmod(d_psi[0] + 2*M_PI*d_fDTs*_GRFASTCOS(d_theta_los), 2*M_PI);
+                d_psi[0] = fmod(d_psi[0] + 2*GR_M_PI*d_fDTs*_GRFASTCOS(d_theta_los), 2*GR_M_PI);
                 float los_i = scale_los*_GRFASTCOS(d_psi[0]);
                 float los_q = scale_los*_GRFASTSIN(d_psi[0]);
                 H = H*scale_nlos + gr_complex(los_i,los_q);
@@ -105,10 +106,10 @@ namespace gr {
     void flat_fader_impl::update_theta()
     {
         d_theta += (d_step*rv_2());
-        if(d_theta > M_PI){
-            d_theta = M_PI; d_step = -d_step;
-        } else if(d_theta < -M_PI){
-            d_theta = -M_PI; d_step = -d_step;
+        if(d_theta > GR_M_PI){
+            d_theta = GR_M_PI; d_step = -d_step;
+        } else if(d_theta < -GR_M_PI){
+            d_theta = -GR_M_PI; d_step = -d_step;
         }
     }
 
diff --git a/gr-channels/lib/selective_fading_model2_impl.cc b/gr-channels/lib/selective_fading_model2_impl.cc
index c9b9d62b1b..a311a837d8 100644
--- a/gr-channels/lib/selective_fading_model2_impl.cc
+++ b/gr-channels/lib/selective_fading_model2_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2013 Free Software Foundation, Inc.
+ * Copyright 2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -21,14 +21,16 @@
  */
 
 #include "selective_fading_model2_impl.h"
+#include <sincostable.h>
+
 #include <gnuradio/io_signature.h>
-#include <iostream>
+#include <gnuradio/fxpt.h>
+#include <gnuradio/math.h>
 
 #include <boost/format.hpp>
 #include <boost/random.hpp>
 
-#include <gnuradio/fxpt.h>
-#include <sincostable.h>
+#include <iostream>
 
 
 // FASTSINCOS:  0 = slow native,  1 = gr::fxpt impl,  2 = sincostable.h
@@ -124,7 +126,7 @@ namespace gr {
                 //gr_complex ff_H(d_faders[j]->next_sample());
                 for(size_t k=0; k<d_taps.size(); k++){
                     float dist = k-d_delays[j];
-                    float interpmag = d_sintable.sinc(2*M_PI*dist);
+                    float interpmag = d_sintable.sinc(2*GR_M_PI*dist);
                     d_taps[k] += ff_H * interpmag * d_mags[j];
                 }
             }
diff --git a/gr-channels/lib/selective_fading_model_impl.cc b/gr-channels/lib/selective_fading_model_impl.cc
index be9c0b1f3a..3a6285f0c8 100644
--- a/gr-channels/lib/selective_fading_model_impl.cc
+++ b/gr-channels/lib/selective_fading_model_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2013 Free Software Foundation, Inc.
+ * Copyright 2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -21,14 +21,16 @@
  */
 
 #include "selective_fading_model_impl.h"
+#include <sincostable.h>
+
 #include <gnuradio/io_signature.h>
-#include <iostream>
+#include <gnuradio/fxpt.h>
+#include <gnuradio/math.h>
 
 #include <boost/format.hpp>
 #include <boost/random.hpp>
 
-#include <gnuradio/fxpt.h>
-#include <sincostable.h>
+#include <iostream>
 
 
 // FASTSINCOS:  0 = slow native,  1 = gr::fxpt impl,  2 = sincostable.h
@@ -103,7 +105,7 @@ namespace gr {
                 //gr_complex ff_H(d_faders[j]->next_sample());
                 for(size_t k=0; k<d_taps.size(); k++){
                     float dist = k-d_delays[j];
-                    float interpmag = d_sintable.sinc(2*M_PI*dist);
+                    float interpmag = d_sintable.sinc(2*GR_M_PI*dist);
                     d_taps[k] += ff_H * interpmag * d_mags[j];
                 }
             }
diff --git a/gr-channels/lib/sincostable.h b/gr-channels/lib/sincostable.h
index 2a5adb6f4c..6ae857412e 100644
--- a/gr-channels/lib/sincostable.h
+++ b/gr-channels/lib/sincostable.h
@@ -1,8 +1,8 @@
 #ifndef SINCOSTABLE_H
 #define SINCOSTABLE_H
 
-#define _USE_MATH_DEFINES
-#include <math.h>
+#include <gnuradio/math.h>
+#include <cmath>
 
 class sincostable {
     std::vector<float> d_cos;
@@ -12,10 +12,10 @@ class sincostable {
     sincostable(size_t tbl_size) :
         d_cos(tbl_size,1),
         d_sz(tbl_size),
-        d_scale(tbl_size/(M_PI*2))
+        d_scale(tbl_size/(GR_M_PI*2))
         {
         for(size_t i=0; i<tbl_size; i++){
-            d_cos[i] = ::cos(2*M_PI*i/tbl_size);
+            d_cos[i] = ::cos(2*GR_M_PI*i/tbl_size);
             }
         }
     const float sin(float x){
diff --git a/gr-digital/lib/constellation.cc b/gr-digital/lib/constellation.cc
index a09a9e5fb9..cf7039b313 100644
--- a/gr-digital/lib/constellation.cc
+++ b/gr-digital/lib/constellation.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2010-2012,2014 Free Software Foundation, Inc.
+ * Copyright 2010-2012,2014,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -28,18 +28,17 @@
 #include <gnuradio/digital/constellation.h>
 #include <gnuradio/math.h>
 #include <gnuradio/gr_complex.h>
+
+#include <boost/format.hpp>
+
 #include <cstdlib>
 #include <cfloat>
 #include <stdexcept>
-#include <boost/format.hpp>
 #include <iostream>
 
 namespace gr {
   namespace digital {
 
-#define M_TWOPI (2*M_PI)
-#define SQRT_TWO 0.707107
-
     // Base Constellation Class
     constellation::constellation(std::vector<gr_complex> constell,
                                  std::vector<int> pre_diff_code,
@@ -624,7 +623,7 @@ namespace gr {
     constellation_psk::get_sector(const gr_complex *sample)
     {
       float phase = arg(*sample);
-      float width = M_TWOPI / n_sectors;
+      float width = GR_M_TWOPI / n_sectors;
       int sector = floor(phase/width + 0.5);
       if(sector < 0)
         sector += n_sectors;
@@ -634,7 +633,7 @@ namespace gr {
     unsigned int
     constellation_psk::calc_sector_value(unsigned int sector)
     {
-      float phase = sector * M_TWOPI / n_sectors;
+      float phase = sector * GR_M_TWOPI / n_sectors;
       gr_complex sector_center = gr_complex(cos(phase), sin(phase));
       unsigned int closest_point = get_closest_point(&sector_center);
       return closest_point;
@@ -684,16 +683,16 @@ namespace gr {
     {
       d_constellation.resize(4);
       // Gray-coded
-      d_constellation[0] = gr_complex(-SQRT_TWO, -SQRT_TWO);
-      d_constellation[1] = gr_complex(SQRT_TWO, -SQRT_TWO);
-      d_constellation[2] = gr_complex(-SQRT_TWO, SQRT_TWO);
-      d_constellation[3] = gr_complex(SQRT_TWO, SQRT_TWO);
+      d_constellation[0] = gr_complex(-GR_M_SQRT2, -GR_M_SQRT2);
+      d_constellation[1] = gr_complex(GR_M_SQRT2, -GR_M_SQRT2);
+      d_constellation[2] = gr_complex(-GR_M_SQRT2, GR_M_SQRT2);
+      d_constellation[3] = gr_complex(GR_M_SQRT2, GR_M_SQRT2);
 
       /*
-        d_constellation[0] = gr_complex(SQRT_TWO, SQRT_TWO);
-        d_constellation[1] = gr_complex(-SQRT_TWO, SQRT_TWO);
-        d_constellation[2] = gr_complex(SQRT_TWO, -SQRT_TWO);
-        d_constellation[3] = gr_complex(SQRT_TWO, -SQRT_TWO);
+        d_constellation[0] = gr_complex(GR_M_SQRT2, GR_M_SQRT2);
+        d_constellation[1] = gr_complex(-GR_M_SQRT2, GR_M_SQRT2);
+        d_constellation[2] = gr_complex(GR_M_SQRT2, -GR_M_SQRT2);
+        d_constellation[3] = gr_complex(GR_M_SQRT2, -GR_M_SQRT2);
       */
 
       d_pre_diff_code.resize(4);
@@ -752,10 +751,10 @@ namespace gr {
       // us to use differential encodings (through diff_encode and
       // diff_decode) on the symbols.
       d_constellation.resize(4);
-      d_constellation[0] = gr_complex(+SQRT_TWO, +SQRT_TWO);
-      d_constellation[1] = gr_complex(-SQRT_TWO, +SQRT_TWO);
-      d_constellation[2] = gr_complex(-SQRT_TWO, -SQRT_TWO);
-      d_constellation[3] = gr_complex(+SQRT_TWO, -SQRT_TWO);
+      d_constellation[0] = gr_complex(+GR_M_SQRT2, +GR_M_SQRT2);
+      d_constellation[1] = gr_complex(-GR_M_SQRT2, +GR_M_SQRT2);
+      d_constellation[2] = gr_complex(-GR_M_SQRT2, -GR_M_SQRT2);
+      d_constellation[3] = gr_complex(+GR_M_SQRT2, -GR_M_SQRT2);
 
       // Use this mapping to convert to gray code before diff enc.
       d_pre_diff_code.resize(4);
@@ -808,7 +807,7 @@ namespace gr {
 
     constellation_8psk::constellation_8psk()
     {
-      float angle = M_PI/8.0;
+      float angle = GR_M_PI/8.0;
       d_constellation.resize(8);
       // Gray-coded
       d_constellation[0] = gr_complex(cos( 1*angle), sin( 1*angle));
@@ -858,7 +857,7 @@ namespace gr {
 
     constellation_8psk_natural::constellation_8psk_natural()
     {
-      float angle = M_PI/8.0;
+      float angle = GR_M_PI/8.0;
       d_constellation.resize(8);
       // Natural-mapping
       d_constellation[0] = gr_complex(cos( 15*angle), sin( 15*angle));
diff --git a/gr-digital/lib/constellation_receiver_cb_impl.cc b/gr-digital/lib/constellation_receiver_cb_impl.cc
index 97c4d8389a..a8911e8a17 100644
--- a/gr-digital/lib/constellation_receiver_cb_impl.cc
+++ b/gr-digital/lib/constellation_receiver_cb_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2011,2012,2013 Free Software Foundation, Inc.
+ * Copyright 2011,2012,2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -34,7 +34,6 @@
 namespace gr {
   namespace digital {
 
-#define M_TWOPI (2*M_PI)
 #define VERBOSE_MM     0     // Used for debugging symbol timing loop
 #define VERBOSE_COSTAS 0     // Used for debugging phase and frequency tracking
 
diff --git a/gr-digital/lib/constellation_receiver_cb_impl.h b/gr-digital/lib/constellation_receiver_cb_impl.h
index 398d74004c..b07f2ff8f5 100644
--- a/gr-digital/lib/constellation_receiver_cb_impl.h
+++ b/gr-digital/lib/constellation_receiver_cb_impl.h
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2011,2012 Free Software Foundation, Inc.
+ * Copyright 2011,2012,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -26,6 +26,7 @@
 #include <gnuradio/digital/constellation_receiver_cb.h>
 #include <gnuradio/attributes.h>
 #include <gnuradio/gr_complex.h>
+#include <gnuradio/math.h>
 
 namespace gr {
   namespace digital {
@@ -68,7 +69,7 @@ namespace gr {
        * Message handler port to update the phase of the rotator. The
        * phase should be a real number (float or double) that is added
        * to the current phase. So we can rotate the constellation by
-       * 90 degress by passing a value of pmt::from_double(M_PI/2).
+       * 90 degress by passing a value of pmt::from_double(GR_M_PI/2).
        */
       void handle_rotate_phase(pmt::pmt_t rotation);
 
diff --git a/gr-digital/lib/cpmmod_bc_impl.cc b/gr-digital/lib/cpmmod_bc_impl.cc
index 4b2457f90e..915881b09f 100644
--- a/gr-digital/lib/cpmmod_bc_impl.cc
+++ b/gr-digital/lib/cpmmod_bc_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2010,2012 Free Software Foundation, Inc.
+ * Copyright 2010,2012,2018 Free Software Foundation, Inc.
  * 
  * GNU Radio is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
 
 #include "cpmmod_bc_impl.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
 
 namespace gr {
   namespace digital {
@@ -62,7 +63,7 @@ namespace gr {
 	d_taps(analog::cpm::phase_response(type, samples_per_sym, L, beta)),
 	d_char_to_float(blocks::char_to_float::make()),
 	d_pulse_shaper(filter::interp_fir_filter_fff::make(samples_per_sym, d_taps)),
-	d_fm(analog::frequency_modulator_fc::make(M_PI * h))
+	d_fm(analog::frequency_modulator_fc::make(GR_M_PI * h))
     {
       switch(type) {
       case analog::cpm::LRC:
diff --git a/gr-digital/lib/ofdm_cyclic_prefixer_impl.cc b/gr-digital/lib/ofdm_cyclic_prefixer_impl.cc
index 9db7273e26..205c2b044c 100644
--- a/gr-digital/lib/ofdm_cyclic_prefixer_impl.cc
+++ b/gr-digital/lib/ofdm_cyclic_prefixer_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /* 
- * Copyright 2013 Free Software Foundation, Inc.
+ * Copyright 2013,2018 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -24,8 +24,9 @@
 #include "config.h"
 #endif
 
-#include <gnuradio/io_signature.h>
 #include "ofdm_cyclic_prefixer_impl.h"
+#include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
 
 namespace gr {
   namespace digital {
@@ -64,8 +65,8 @@ namespace gr {
 	// The actual flanks are one sample shorter than d_rolloff_len, because the
 	// first sample of the up- and down flank is always zero and one, respectively
 	for (int i = 1; i < d_rolloff_len; i++) {
-	  d_up_flank[i-1]   = 0.5 * (1 + cos(M_PI * i/rolloff_len - M_PI));
-	  d_down_flank[i-1] = 0.5 * (1 + cos(M_PI * (rolloff_len-i)/rolloff_len - M_PI));
+	  d_up_flank[i-1]   = 0.5 * (1 + cos(GR_M_PI * i/rolloff_len - GR_M_PI));
+	  d_down_flank[i-1] = 0.5 * (1 + cos(GR_M_PI * (rolloff_len-i)/rolloff_len - GR_M_PI));
 	}
       }
 
diff --git a/gr-digital/lib/ofdm_frame_acquisition_impl.cc b/gr-digital/lib/ofdm_frame_acquisition_impl.cc
index 02b587c1de..0f44650fe0 100644
--- a/gr-digital/lib/ofdm_frame_acquisition_impl.cc
+++ b/gr-digital/lib/ofdm_frame_acquisition_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2006-2008,2010,2011 Free Software Foundation, Inc.
+ * Copyright 2006-2008,2010,2011,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -34,7 +34,6 @@ namespace gr {
   namespace digital {
 
 #define VERBOSE 0
-#define M_TWOPI (2*M_PI)
 #define MAX_NUM_SYMBOLS 1000
 
     ofdm_frame_acquisition::sptr
@@ -81,7 +80,7 @@ namespace gr {
       d_phase_lut = new gr_complex[(2*d_freq_shift_len+1) * MAX_NUM_SYMBOLS];
       for(i = 0; i <= 2*d_freq_shift_len; i++) {
 	for(j = 0; j < MAX_NUM_SYMBOLS; j++) {
-	  d_phase_lut[j + i*MAX_NUM_SYMBOLS] =  gr_expj(-M_TWOPI*d_cplen/d_fft_length*(i-d_freq_shift_len)*j);
+	  d_phase_lut[j + i*MAX_NUM_SYMBOLS] =  gr_expj(-GR_M_TWOPI*d_cplen/d_fft_length*(i-d_freq_shift_len)*j);
 	}
       }
     }
@@ -102,10 +101,10 @@ namespace gr {
     gr_complex
     ofdm_frame_acquisition_impl::coarse_freq_comp(int freq_delta, int symbol_count)
     {
-      //  return gr_complex(cos(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count),
-      //	    sin(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count));
+      //  return gr_complex(cos(-GR_M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count),
+      //	    sin(-GR_M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count));
 
-      return gr_expj(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count);
+      return gr_expj(-GR_M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count);
 
       //return d_phase_lut[MAX_NUM_SYMBOLS * (d_freq_shift_len + freq_delta) + symbol_count];
     }
diff --git a/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc b/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc
index 1b0dee4055..2463c31157 100644
--- a/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc
+++ b/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc
@@ -1,5 +1,5 @@
 /* -*- c++ -*- */
-/* Copyright 2012 Free Software Foundation, Inc.
+/* Copyright 2012,2018 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -23,11 +23,10 @@
 #include "config.h"
 #endif
 
-#include <gnuradio/expj.h>
-#include <gnuradio/io_signature.h>
 #include "ofdm_frame_equalizer_vcvc_impl.h"
-
-#define M_TWOPI (2*M_PI)
+#include <gnuradio/io_signature.h>
+#include <gnuradio/expj.h>
+#include <gnuradio/math.h>
 
 static const pmt::pmt_t CARR_OFFSET_KEY = pmt::mp("ofdm_sync_carr_offset");
 static const pmt::pmt_t CHAN_TAPS_KEY = pmt::mp("ofdm_sync_chan_taps");
@@ -146,7 +145,7 @@ namespace gr {
       // Correct the frequency shift on the symbols
       gr_complex phase_correction;
       for (int i = 0; i < frame_len; i++) {
-	phase_correction = gr_expj(-M_TWOPI * carrier_offset * d_cp_len / d_fft_len * (i+1));
+	phase_correction = gr_expj(-GR_M_TWOPI * carrier_offset * d_cp_len / d_fft_len * (i+1));
 	for (int k = 0; k < d_fft_len; k++) {
 	  out[i*d_fft_len+k] *= phase_correction;
 	}
@@ -158,7 +157,7 @@ namespace gr {
       d_eq->get_channel_state(d_channel_state);
 
       // Update the channel state regarding the frequency offset
-      phase_correction = gr_expj(M_TWOPI * carrier_offset * d_cp_len / d_fft_len * frame_len);
+      phase_correction = gr_expj(GR_M_TWOPI * carrier_offset * d_cp_len / d_fft_len * frame_len);
       for (int k = 0; k < d_fft_len; k++) {
         d_channel_state[k] *= phase_correction;
       }
diff --git a/gr-digital/lib/ofdm_frame_sink_impl.cc b/gr-digital/lib/ofdm_frame_sink_impl.cc
index 2493667255..b00646f935 100644
--- a/gr-digital/lib/ofdm_frame_sink_impl.cc
+++ b/gr-digital/lib/ofdm_frame_sink_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2007,2008,2010-2012 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2010-2012,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -171,10 +171,10 @@ namespace gr {
 
       d_freq = d_freq - d_freq_gain*angle;
       d_phase = d_phase + d_freq - d_phase_gain*angle;
-      if(d_phase >= 2*M_PI)
-	d_phase -= 2*M_PI;
+      if(d_phase >= 2*GR_M_PI)
+	d_phase -= 2*GR_M_PI;
       if(d_phase <0)
-	d_phase += 2*M_PI;
+	d_phase += 2*GR_M_PI;
 
       //if(VERBOSE)
       //  std::cerr << angle << "\t" << d_freq << "\t" << d_phase << "\t" << std::endl;
diff --git a/gr-dtv/lib/atsc/atsc_fpll_impl.cc b/gr-dtv/lib/atsc/atsc_fpll_impl.cc
index 2015e350ef..a552004972 100644
--- a/gr-dtv/lib/atsc/atsc_fpll_impl.cc
+++ b/gr-dtv/lib/atsc/atsc_fpll_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2014 Free Software Foundation, Inc.
+ * Copyright 2014,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -45,7 +45,7 @@ namespace gr {
                    io_signature::make(1, 1, sizeof(float)))
     {
       d_afc.set_taps(1.0-exp(-1.0/rate/5e-6));
-      d_nco.set_freq((-3e6 + 0.309e6)/rate*2*M_PI);
+      d_nco.set_freq((-3e6 + 0.309e6)/rate*2*GR_M_PI);
       d_nco.set_phase(0.0);
     }
 
@@ -76,7 +76,7 @@ namespace gr {
         float x = gr::fast_atan2f(filtered.imag(), filtered.real());
 
         // avoid slamming filter with big transitions
-        static const float limit = M_PI/2.0;
+        static const float limit = GR_M_PI/2.0;
         if (x > limit)
           x = limit;
         else if (x < -limit)
diff --git a/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.cc b/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.cc
index 4ceefa1503..e40e602494 100644
--- a/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.cc
+++ b/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /* 
- * Copyright 2015-2017 Free Software Foundation, Inc.
+ * Copyright 2015-2018 Free Software Foundation, Inc.
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,8 +22,9 @@
 #include "config.h"
 #endif
 
-#include <gnuradio/io_signature.h>
 #include "dvbs2_modulator_bc_impl.h"
+#include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
 
 namespace gr {
   namespace dtv {
@@ -49,26 +50,26 @@ namespace gr {
       switch (constellation) {
         case MOD_BPSK:
         case MOD_BPSK_SF2:
-          m_bpsk[0][0] = gr_complex((r1 * cos(M_PI / 4.0)), (r1 * sin(M_PI / 4.0)));
-          m_bpsk[0][1] = gr_complex((r1 * cos(5.0 * M_PI / 4.0)), (r1 * sin(5.0 * M_PI / 4.0)));
-          m_bpsk[1][0] = gr_complex((r1 * cos(5.0 * M_PI / 4.0)), (r1 * sin(M_PI / 4.0)));
-          m_bpsk[1][1] = gr_complex((r1 * cos(M_PI / 4.0)), (r1 * sin(5.0 * M_PI /4.0)));
+          m_bpsk[0][0] = gr_complex((r1 * cos(GR_M_PI / 4.0)), (r1 * sin(GR_M_PI / 4.0)));
+          m_bpsk[0][1] = gr_complex((r1 * cos(5.0 * GR_M_PI / 4.0)), (r1 * sin(5.0 * GR_M_PI / 4.0)));
+          m_bpsk[1][0] = gr_complex((r1 * cos(5.0 * GR_M_PI / 4.0)), (r1 * sin(GR_M_PI / 4.0)));
+          m_bpsk[1][1] = gr_complex((r1 * cos(GR_M_PI / 4.0)), (r1 * sin(5.0 * GR_M_PI /4.0)));
           break;
         case MOD_QPSK:
-          m_qpsk[0] = gr_complex((r1 * cos(M_PI / 4.0)), (r1 * sin(M_PI / 4.0)));
-          m_qpsk[1] = gr_complex((r1 * cos(7 * M_PI / 4.0)), (r1 * sin(7 * M_PI / 4.0)));
-          m_qpsk[2] = gr_complex((r1 * cos(3 * M_PI / 4.0)), (r1 * sin(3 * M_PI / 4.0)));
-          m_qpsk[3] = gr_complex((r1 * cos(5 * M_PI / 4.0)), (r1 * sin(5 * M_PI / 4.0)));
+          m_qpsk[0] = gr_complex((r1 * cos(GR_M_PI / 4.0)), (r1 * sin(GR_M_PI / 4.0)));
+          m_qpsk[1] = gr_complex((r1 * cos(7 * GR_M_PI / 4.0)), (r1 * sin(7 * GR_M_PI / 4.0)));
+          m_qpsk[2] = gr_complex((r1 * cos(3 * GR_M_PI / 4.0)), (r1 * sin(3 * GR_M_PI / 4.0)));
+          m_qpsk[3] = gr_complex((r1 * cos(5 * GR_M_PI / 4.0)), (r1 * sin(5 * GR_M_PI / 4.0)));
           break;
         case MOD_8PSK:
-          m_8psk[0] = gr_complex((r1 * cos(M_PI / 4.0)), (r1 * sin(M_PI / 4.0)));
+          m_8psk[0] = gr_complex((r1 * cos(GR_M_PI / 4.0)), (r1 * sin(GR_M_PI / 4.0)));
           m_8psk[1] = gr_complex((r1 * cos(0.0)), (r1 * sin(0.0)));
-          m_8psk[2] = gr_complex((r1 * cos(4 * M_PI / 4.0)), (r1 * sin(4 * M_PI / 4.0)));
-          m_8psk[3] = gr_complex((r1 * cos(5 * M_PI / 4.0)), (r1 * sin(5 * M_PI / 4.0)));
-          m_8psk[4] = gr_complex((r1 * cos(2 * M_PI / 4.0)), (r1 * sin(2 * M_PI / 4.0)));
-          m_8psk[5] = gr_complex((r1 * cos(7 * M_PI / 4.0)), (r1 * sin(7 * M_PI / 4.0)));
-          m_8psk[6] = gr_complex((r1 * cos(3 * M_PI / 4.0)), (r1 * sin(3 * M_PI / 4.0)));
-          m_8psk[7] = gr_complex((r1 * cos(6 * M_PI / 4.0)), (r1 * sin(6 * M_PI / 4.0)));
+          m_8psk[2] = gr_complex((r1 * cos(4 * GR_M_PI / 4.0)), (r1 * sin(4 * GR_M_PI / 4.0)));
+          m_8psk[3] = gr_complex((r1 * cos(5 * GR_M_PI / 4.0)), (r1 * sin(5 * GR_M_PI / 4.0)));
+          m_8psk[4] = gr_complex((r1 * cos(2 * GR_M_PI / 4.0)), (r1 * sin(2 * GR_M_PI / 4.0)));
+          m_8psk[5] = gr_complex((r1 * cos(7 * GR_M_PI / 4.0)), (r1 * sin(7 * GR_M_PI / 4.0)));
+          m_8psk[6] = gr_complex((r1 * cos(3 * GR_M_PI / 4.0)), (r1 * sin(3 * GR_M_PI / 4.0)));
+          m_8psk[7] = gr_complex((r1 * cos(6 * GR_M_PI / 4.0)), (r1 * sin(6 * GR_M_PI / 4.0)));
           break;
         case MOD_8APSK:
           r3 = m;
@@ -86,13 +87,13 @@ namespace gr {
               r2 = 0;
               break;
           }
-          m_8psk[0] = gr_complex((r1 * cos(M_PI)), (r1 * sin(M_PI)));
-          m_8psk[1] = gr_complex((r2 * cos(M_PI * 1.352)), (r2 * sin(M_PI * 1.352)));
-          m_8psk[2] = gr_complex((r2 * cos(M_PI * -1.352)), (r2 * sin(M_PI * -1.352)));
-          m_8psk[3] = gr_complex((r3 * cos(M_PI)), (r3 * sin(M_PI)));
+          m_8psk[0] = gr_complex((r1 * cos(GR_M_PI)), (r1 * sin(GR_M_PI)));
+          m_8psk[1] = gr_complex((r2 * cos(GR_M_PI * 1.352)), (r2 * sin(GR_M_PI * 1.352)));
+          m_8psk[2] = gr_complex((r2 * cos(GR_M_PI * -1.352)), (r2 * sin(GR_M_PI * -1.352)));
+          m_8psk[3] = gr_complex((r3 * cos(GR_M_PI)), (r3 * sin(GR_M_PI)));
           m_8psk[4] = gr_complex((r1 * cos(0.0)), (r1 * sin(0.0)));
-          m_8psk[5] = gr_complex((r2 * cos(M_PI * -0.352)), (r2 * sin(M_PI * -0.352)));
-          m_8psk[6] = gr_complex((r2 * cos(M_PI * 0.352)), (r2 * sin(M_PI * 0.352)));
+          m_8psk[5] = gr_complex((r2 * cos(GR_M_PI * -0.352)), (r2 * sin(GR_M_PI * -0.352)));
+          m_8psk[6] = gr_complex((r2 * cos(GR_M_PI * 0.352)), (r2 * sin(GR_M_PI * 0.352)));
           m_8psk[7] = gr_complex((r3 * cos(0.0)), (r3 * sin(0.0)));
           break;
         case MOD_16APSK:
@@ -177,22 +178,22 @@ namespace gr {
                 break;
             }
           }
-          m_16apsk[0] = gr_complex((r2 * cos(M_PI / 4.0)), (r2 * sin(M_PI / 4.0)));
-          m_16apsk[1] = gr_complex((r2 * cos(-M_PI / 4.0)), (r2 * sin(-M_PI / 4.0)));
-          m_16apsk[2] = gr_complex((r2 * cos(3 * M_PI / 4.0)), (r2 * sin(3 * M_PI / 4.0)));
-          m_16apsk[3] = gr_complex((r2 * cos(-3 * M_PI / 4.0)), (r2 * sin(-3 * M_PI / 4.0)));
-          m_16apsk[4] = gr_complex((r2 * cos(M_PI / 12.0)), (r2 * sin(M_PI / 12.0)));
-          m_16apsk[5] = gr_complex((r2 * cos(-M_PI / 12.0)), (r2 * sin(-M_PI / 12.0)));
-          m_16apsk[6] = gr_complex((r2 * cos(11 * M_PI / 12.0)), (r2 * sin(11 * M_PI / 12.0)));
-          m_16apsk[7] = gr_complex((r2 * cos(-11 * M_PI / 12.0)), (r2 * sin(-11 * M_PI / 12.0)));
-          m_16apsk[8] = gr_complex((r2 * cos(5 * M_PI / 12.0)), (r2 * sin(5 * M_PI / 12.0)));
-          m_16apsk[9] = gr_complex((r2 * cos(-5 * M_PI / 12.0)), (r2 * sin(-5 * M_PI / 12.0)));
-          m_16apsk[10] = gr_complex((r2 * cos(7 * M_PI / 12.0)), (r2 * sin(7 * M_PI / 12.0)));
-          m_16apsk[11] = gr_complex((r2 * cos(-7 * M_PI / 12.0)), (r2 * sin(-7 * M_PI / 12.0)));
-          m_16apsk[12] = gr_complex((r1 * cos(M_PI / 4.0)), (r1 * sin(M_PI / 4.0)));
-          m_16apsk[13] = gr_complex((r1 * cos(-M_PI / 4.0)), (r1 * sin(-M_PI / 4.0)));
-          m_16apsk[14] = gr_complex((r1 * cos(3 * M_PI / 4.0)), (r1 * sin(3 * M_PI / 4.0)));
-          m_16apsk[15] = gr_complex((r1 * cos(-3 * M_PI / 4.0)), (r1 * sin(-3 * M_PI / 4.0)));
+          m_16apsk[0] = gr_complex((r2 * cos(GR_M_PI / 4.0)), (r2 * sin(GR_M_PI / 4.0)));
+          m_16apsk[1] = gr_complex((r2 * cos(-GR_M_PI / 4.0)), (r2 * sin(-GR_M_PI / 4.0)));
+          m_16apsk[2] = gr_complex((r2 * cos(3 * GR_M_PI / 4.0)), (r2 * sin(3 * GR_M_PI / 4.0)));
+          m_16apsk[3] = gr_complex((r2 * cos(-3 * GR_M_PI / 4.0)), (r2 * sin(-3 * GR_M_PI / 4.0)));
+          m_16apsk[4] = gr_complex((r2 * cos(GR_M_PI / 12.0)), (r2 * sin(GR_M_PI / 12.0)));
+          m_16apsk[5] = gr_complex((r2 * cos(-GR_M_PI / 12.0)), (r2 * sin(-GR_M_PI / 12.0)));
+          m_16apsk[6] = gr_complex((r2 * cos(11 * GR_M_PI / 12.0)), (r2 * sin(11 * GR_M_PI / 12.0)));
+          m_16apsk[7] = gr_complex((r2 * cos(-11 * GR_M_PI / 12.0)), (r2 * sin(-11 * GR_M_PI / 12.0)));
+          m_16apsk[8] = gr_complex((r2 * cos(5 * GR_M_PI / 12.0)), (r2 * sin(5 * GR_M_PI / 12.0)));
+          m_16apsk[9] = gr_complex((r2 * cos(-5 * GR_M_PI / 12.0)), (r2 * sin(-5 * GR_M_PI / 12.0)));
+          m_16apsk[10] = gr_complex((r2 * cos(7 * GR_M_PI / 12.0)), (r2 * sin(7 * GR_M_PI / 12.0)));
+          m_16apsk[11] = gr_complex((r2 * cos(-7 * GR_M_PI / 12.0)), (r2 * sin(-7 * GR_M_PI / 12.0)));
+          m_16apsk[12] = gr_complex((r1 * cos(GR_M_PI / 4.0)), (r1 * sin(GR_M_PI / 4.0)));
+          m_16apsk[13] = gr_complex((r1 * cos(-GR_M_PI / 4.0)), (r1 * sin(-GR_M_PI / 4.0)));
+          m_16apsk[14] = gr_complex((r1 * cos(3 * GR_M_PI / 4.0)), (r1 * sin(3 * GR_M_PI / 4.0)));
+          m_16apsk[15] = gr_complex((r1 * cos(-3 * GR_M_PI / 4.0)), (r1 * sin(-3 * GR_M_PI / 4.0)));
           break;
         case MOD_8_8APSK:
           if (rate == C18_30) {
@@ -243,22 +244,22 @@ namespace gr {
                 r1 = 0;
                 break;
             }
-            m_16apsk[0] = gr_complex((r1 * cos(M_PI / 8.0)), (r1 * sin(M_PI / 8.0)));
-            m_16apsk[1] = gr_complex((r1 * cos(3 * M_PI / 8.0)), (r1 * sin(3 * M_PI / 8.0)));
-            m_16apsk[2] = gr_complex((r1 * cos(7 * M_PI / 8.0)), (r1 * sin(7 * M_PI / 8.0)));
-            m_16apsk[3] = gr_complex((r1 * cos(5 * M_PI / 8.0)), (r1 * sin(5 * M_PI / 8.0)));
-            m_16apsk[4] = gr_complex((r1 * cos(15 * M_PI / 8.0)), (r1 * sin(15 * M_PI / 8.0)));
-            m_16apsk[5] = gr_complex((r1 * cos(13 * M_PI / 8.0)), (r1 * sin(13 * M_PI / 8.0)));
-            m_16apsk[6] = gr_complex((r1 * cos(9 * M_PI / 8.0)), (r1 * sin(9 * M_PI / 8.0)));
-            m_16apsk[7] = gr_complex((r1 * cos(11 * M_PI / 8.0)), (r1 * sin(11 * M_PI / 8.0)));
-            m_16apsk[8] = gr_complex((r2 * cos(M_PI / 8.0)), (r2 * sin(M_PI / 8.0)));
-            m_16apsk[9] = gr_complex((r2 * cos(3 * M_PI / 8.0)), (r2 * sin(3 * M_PI / 8.0)));
-            m_16apsk[10] = gr_complex((r2 * cos(7 * M_PI / 8.0)), (r2 * sin(7 * M_PI / 8.0)));
-            m_16apsk[11] = gr_complex((r2 * cos(5 * M_PI / 8.0)), (r2 * sin(5 * M_PI / 8.0)));
-            m_16apsk[12] = gr_complex((r2 * cos(15 * M_PI / 8.0)), (r2 * sin(15 * M_PI / 8.0)));
-            m_16apsk[13] = gr_complex((r2 * cos(13 * M_PI / 8.0)), (r2 * sin(13 * M_PI / 8.0)));
-            m_16apsk[14] = gr_complex((r2 * cos(9 * M_PI / 8.0)), (r2 * sin(9 * M_PI / 8.0)));
-            m_16apsk[15] = gr_complex((r2 * cos(11 * M_PI / 8.0)), (r2 * sin(11 * M_PI / 8.0)));
+            m_16apsk[0] = gr_complex((r1 * cos(GR_M_PI / 8.0)), (r1 * sin(GR_M_PI / 8.0)));
+            m_16apsk[1] = gr_complex((r1 * cos(3 * GR_M_PI / 8.0)), (r1 * sin(3 * GR_M_PI / 8.0)));
+            m_16apsk[2] = gr_complex((r1 * cos(7 * GR_M_PI / 8.0)), (r1 * sin(7 * GR_M_PI / 8.0)));
+            m_16apsk[3] = gr_complex((r1 * cos(5 * GR_M_PI / 8.0)), (r1 * sin(5 * GR_M_PI / 8.0)));
+            m_16apsk[4] = gr_complex((r1 * cos(15 * GR_M_PI / 8.0)), (r1 * sin(15 * GR_M_PI / 8.0)));
+            m_16apsk[5] = gr_complex((r1 * cos(13 * GR_M_PI / 8.0)), (r1 * sin(13 * GR_M_PI / 8.0)));
+            m_16apsk[6] = gr_complex((r1 * cos(9 * GR_M_PI / 8.0)), (r1 * sin(9 * GR_M_PI / 8.0)));
+            m_16apsk[7] = gr_complex((r1 * cos(11 * GR_M_PI / 8.0)), (r1 * sin(11 * GR_M_PI / 8.0)));
+            m_16apsk[8] = gr_complex((r2 * cos(GR_M_PI / 8.0)), (r2 * sin(GR_M_PI / 8.0)));
+            m_16apsk[9] = gr_complex((r2 * cos(3 * GR_M_PI / 8.0)), (r2 * sin(3 * GR_M_PI / 8.0)));
+            m_16apsk[10] = gr_complex((r2 * cos(7 * GR_M_PI / 8.0)), (r2 * sin(7 * GR_M_PI / 8.0)));
+            m_16apsk[11] = gr_complex((r2 * cos(5 * GR_M_PI / 8.0)), (r2 * sin(5 * GR_M_PI / 8.0)));
+            m_16apsk[12] = gr_complex((r2 * cos(15 * GR_M_PI / 8.0)), (r2 * sin(15 * GR_M_PI / 8.0)));
+            m_16apsk[13] = gr_complex((r2 * cos(13 * GR_M_PI / 8.0)), (r2 * sin(13 * GR_M_PI / 8.0)));
+            m_16apsk[14] = gr_complex((r2 * cos(9 * GR_M_PI / 8.0)), (r2 * sin(9 * GR_M_PI / 8.0)));
+            m_16apsk[15] = gr_complex((r2 * cos(11 * GR_M_PI / 8.0)), (r2 * sin(11 * GR_M_PI / 8.0)));
           }
           break;
         case MOD_32APSK:
@@ -289,38 +290,38 @@ namespace gr {
               r2 = 0;
               break;
           }
-          m_32apsk[0] = gr_complex((r2 * cos(M_PI / 4.0)), (r2 * sin(M_PI / 4.0)));
-          m_32apsk[1] = gr_complex((r2 * cos(5 * M_PI / 12.0)), (r2 * sin(5 * M_PI / 12.0)));
-          m_32apsk[2] = gr_complex((r2 * cos(-M_PI / 4.0)), (r2 * sin(-M_PI / 4.0)));
-          m_32apsk[3] = gr_complex((r2 * cos(-5 * M_PI / 12.0)), (r2 * sin(-5 * M_PI / 12.0)));
-          m_32apsk[4] = gr_complex((r2 * cos(3 * M_PI / 4.0)), (r2 * sin(3 * M_PI / 4.0)));
-          m_32apsk[5] = gr_complex((r2 * cos(7 * M_PI / 12.0)), (r2 * sin(7 * M_PI / 12.0)));
-          m_32apsk[6] = gr_complex((r2 * cos(-3 * M_PI / 4.0)), (r2 * sin(-3 * M_PI / 4.0)));
-          m_32apsk[7] = gr_complex((r2 * cos(-7 * M_PI / 12.0)), (r2 * sin(-7 * M_PI / 12.0)));
-          m_32apsk[8] = gr_complex((r3 * cos(M_PI / 8.0)), (r3 * sin(M_PI / 8.0)));
-          m_32apsk[9] = gr_complex((r3 * cos(3 * M_PI / 8.0)), (r3 * sin(3 * M_PI / 8.0)));
-          m_32apsk[10] = gr_complex((r3 * cos(-M_PI / 4.0)), (r3 * sin(-M_PI / 4.0)));
-          m_32apsk[11] = gr_complex((r3 * cos(-M_PI / 2.0)), (r3 * sin(-M_PI / 2.0)));
-          m_32apsk[12] = gr_complex((r3 * cos(3 * M_PI / 4.0)), (r3 * sin(3 * M_PI / 4.0)));
-          m_32apsk[13] = gr_complex((r3 * cos(M_PI / 2.0)), (r3 * sin(M_PI / 2.0)));
-          m_32apsk[14] = gr_complex((r3 * cos(-7 * M_PI / 8.0)), (r3 * sin(-7 * M_PI / 8.0)));
-          m_32apsk[15] = gr_complex((r3 * cos(-5 * M_PI / 8.0)), (r3 * sin(-5 * M_PI / 8.0)));
-          m_32apsk[16] = gr_complex((r2 * cos(M_PI / 12.0)), (r2 * sin(M_PI / 12.0)));
-          m_32apsk[17] = gr_complex((r1 * cos(M_PI / 4.0)), (r1 * sin(M_PI / 4.0)));
-          m_32apsk[18] = gr_complex((r2 * cos(-M_PI / 12.0)), (r2 * sin(-M_PI / 12.0)));
-          m_32apsk[19] = gr_complex((r1 * cos(-M_PI / 4.0)), (r1 * sin(-M_PI / 4.0)));
-          m_32apsk[20] = gr_complex((r2 * cos(11 * M_PI / 12.0)), (r2 * sin(11 * M_PI / 12.0)));
-          m_32apsk[21] = gr_complex((r1 * cos(3 * M_PI / 4.0)), (r1 * sin(3 * M_PI / 4.0)));
-          m_32apsk[22] = gr_complex((r2 * cos(-11 * M_PI / 12.0)), (r2 * sin(-11 * M_PI / 12.0)));
-          m_32apsk[23] = gr_complex((r1 * cos(-3 * M_PI / 4.0)), (r1 * sin(-3 * M_PI / 4.0)));
+          m_32apsk[0] = gr_complex((r2 * cos(GR_M_PI / 4.0)), (r2 * sin(GR_M_PI / 4.0)));
+          m_32apsk[1] = gr_complex((r2 * cos(5 * GR_M_PI / 12.0)), (r2 * sin(5 * GR_M_PI / 12.0)));
+          m_32apsk[2] = gr_complex((r2 * cos(-GR_M_PI / 4.0)), (r2 * sin(-GR_M_PI / 4.0)));
+          m_32apsk[3] = gr_complex((r2 * cos(-5 * GR_M_PI / 12.0)), (r2 * sin(-5 * GR_M_PI / 12.0)));
+          m_32apsk[4] = gr_complex((r2 * cos(3 * GR_M_PI / 4.0)), (r2 * sin(3 * GR_M_PI / 4.0)));
+          m_32apsk[5] = gr_complex((r2 * cos(7 * GR_M_PI / 12.0)), (r2 * sin(7 * GR_M_PI / 12.0)));
+          m_32apsk[6] = gr_complex((r2 * cos(-3 * GR_M_PI / 4.0)), (r2 * sin(-3 * GR_M_PI / 4.0)));
+          m_32apsk[7] = gr_complex((r2 * cos(-7 * GR_M_PI / 12.0)), (r2 * sin(-7 * GR_M_PI / 12.0)));
+          m_32apsk[8] = gr_complex((r3 * cos(GR_M_PI / 8.0)), (r3 * sin(GR_M_PI / 8.0)));
+          m_32apsk[9] = gr_complex((r3 * cos(3 * GR_M_PI / 8.0)), (r3 * sin(3 * GR_M_PI / 8.0)));
+          m_32apsk[10] = gr_complex((r3 * cos(-GR_M_PI / 4.0)), (r3 * sin(-GR_M_PI / 4.0)));
+          m_32apsk[11] = gr_complex((r3 * cos(-GR_M_PI / 2.0)), (r3 * sin(-GR_M_PI / 2.0)));
+          m_32apsk[12] = gr_complex((r3 * cos(3 * GR_M_PI / 4.0)), (r3 * sin(3 * GR_M_PI / 4.0)));
+          m_32apsk[13] = gr_complex((r3 * cos(GR_M_PI / 2.0)), (r3 * sin(GR_M_PI / 2.0)));
+          m_32apsk[14] = gr_complex((r3 * cos(-7 * GR_M_PI / 8.0)), (r3 * sin(-7 * GR_M_PI / 8.0)));
+          m_32apsk[15] = gr_complex((r3 * cos(-5 * GR_M_PI / 8.0)), (r3 * sin(-5 * GR_M_PI / 8.0)));
+          m_32apsk[16] = gr_complex((r2 * cos(GR_M_PI / 12.0)), (r2 * sin(GR_M_PI / 12.0)));
+          m_32apsk[17] = gr_complex((r1 * cos(GR_M_PI / 4.0)), (r1 * sin(GR_M_PI / 4.0)));
+          m_32apsk[18] = gr_complex((r2 * cos(-GR_M_PI / 12.0)), (r2 * sin(-GR_M_PI / 12.0)));
+          m_32apsk[19] = gr_complex((r1 * cos(-GR_M_PI / 4.0)), (r1 * sin(-GR_M_PI / 4.0)));
+          m_32apsk[20] = gr_complex((r2 * cos(11 * GR_M_PI / 12.0)), (r2 * sin(11 * GR_M_PI / 12.0)));
+          m_32apsk[21] = gr_complex((r1 * cos(3 * GR_M_PI / 4.0)), (r1 * sin(3 * GR_M_PI / 4.0)));
+          m_32apsk[22] = gr_complex((r2 * cos(-11 * GR_M_PI / 12.0)), (r2 * sin(-11 * GR_M_PI / 12.0)));
+          m_32apsk[23] = gr_complex((r1 * cos(-3 * GR_M_PI / 4.0)), (r1 * sin(-3 * GR_M_PI / 4.0)));
           m_32apsk[24] = gr_complex((r3 * cos(0.0)), (r3 * sin(0.0)));
-          m_32apsk[25] = gr_complex((r3 * cos(M_PI / 4.0)), (r3 * sin(M_PI / 4.0)));
-          m_32apsk[26] = gr_complex((r3 * cos(-M_PI / 8.0)), (r3 * sin(-M_PI / 8.0)));
-          m_32apsk[27] = gr_complex((r3 * cos(-3 * M_PI / 8.0)), (r3 * sin(-3 * M_PI / 8.0)));
-          m_32apsk[28] = gr_complex((r3 * cos(7 * M_PI / 8.0)), (r3 * sin(7 * M_PI / 8.0)));
-          m_32apsk[29] = gr_complex((r3 * cos(5 * M_PI / 8.0)), (r3 * sin(5 * M_PI / 8.0)));
-          m_32apsk[30] = gr_complex((r3 * cos(M_PI)), (r3 * sin(M_PI)));
-          m_32apsk[31] = gr_complex((r3 * cos(-3 * M_PI / 4.0)), (r3 * sin(-3 * M_PI / 4.0)));
+          m_32apsk[25] = gr_complex((r3 * cos(GR_M_PI / 4.0)), (r3 * sin(GR_M_PI / 4.0)));
+          m_32apsk[26] = gr_complex((r3 * cos(-GR_M_PI / 8.0)), (r3 * sin(-GR_M_PI / 8.0)));
+          m_32apsk[27] = gr_complex((r3 * cos(-3 * GR_M_PI / 8.0)), (r3 * sin(-3 * GR_M_PI / 8.0)));
+          m_32apsk[28] = gr_complex((r3 * cos(7 * GR_M_PI / 8.0)), (r3 * sin(7 * GR_M_PI / 8.0)));
+          m_32apsk[29] = gr_complex((r3 * cos(5 * GR_M_PI / 8.0)), (r3 * sin(5 * GR_M_PI / 8.0)));
+          m_32apsk[30] = gr_complex((r3 * cos(GR_M_PI)), (r3 * sin(GR_M_PI)));
+          m_32apsk[31] = gr_complex((r3 * cos(-3 * GR_M_PI / 4.0)), (r3 * sin(-3 * GR_M_PI / 4.0)));
           break;
         case MOD_4_12_16APSK:
           r3 = m;
@@ -352,38 +353,38 @@ namespace gr {
                 break;
             }
           }
-          m_32apsk[0] = gr_complex((r3 * cos(11 * M_PI / 16.0)), (r3 * sin(11 * M_PI / 16.0)));
-          m_32apsk[1] = gr_complex((r3 * cos(9 * M_PI / 16.0)), (r3 * sin(9 * M_PI / 16.0)));
-          m_32apsk[2] = gr_complex((r3 * cos(5 * M_PI / 16.0)), (r3 * sin(5 * M_PI / 16.0)));
-          m_32apsk[3] = gr_complex((r3 * cos(7 * M_PI / 16.0)), (r3 * sin(7 * M_PI / 16.0)));
-          m_32apsk[4] = gr_complex((r2 * cos(3 * M_PI / 4.0)), (r2 * sin(3 * M_PI / 4.0)));
-          m_32apsk[5] = gr_complex((r2 * cos(7 * M_PI / 12.0)), (r2 * sin(7 * M_PI / 12.0)));
-          m_32apsk[6] = gr_complex((r2 * cos(M_PI / 4.0)), (r2 * sin(M_PI / 4.0)));
-          m_32apsk[7] = gr_complex((r2 * cos(5 * M_PI / 12.0)), (r2 * sin(5 * M_PI / 12.0)));
-          m_32apsk[8] = gr_complex((r3 * cos(13 * M_PI / 16.0)), (r3 * sin(13 * M_PI / 16.0)));
-          m_32apsk[9] = gr_complex((r3 * cos(15 * M_PI / 16.0)), (r3 * sin(15 * M_PI / 16.0)));
-          m_32apsk[10] = gr_complex((r3 * cos(3 * M_PI / 16.0)), (r3 * sin(3 * M_PI / 16.0)));
-          m_32apsk[11] = gr_complex((r3 * cos(M_PI / 16.0)), (r3 * sin(M_PI / 16.0)));
-          m_32apsk[12] = gr_complex((r2 * cos(11 * M_PI / 12.0)), (r2 * sin(11 * M_PI / 12.0)));
-          m_32apsk[13] = gr_complex((r1 * cos(3 * M_PI / 4.0)), (r1 * sin(3 * M_PI / 4.0)));
-          m_32apsk[14] = gr_complex((r2 * cos(M_PI / 12.0)), (r2 * sin(M_PI / 12.0)));
-          m_32apsk[15] = gr_complex((r1 * cos(M_PI / 4.0)), (r1 * sin(M_PI / 4.0)));
-          m_32apsk[16] = gr_complex((r3 * cos(21 * M_PI / 16.0)), (r3 * sin(21 * M_PI / 16.0)));
-          m_32apsk[17] = gr_complex((r3 * cos(23 * M_PI / 16.0)), (r3 * sin(23 * M_PI / 16.0)));
-          m_32apsk[18] = gr_complex((r3 * cos(27 * M_PI / 16.0)), (r3 * sin(27 * M_PI / 16.0)));
-          m_32apsk[19] = gr_complex((r3 * cos(25 * M_PI / 16.0)), (r3 * sin(25 * M_PI / 16.0)));
-          m_32apsk[20] = gr_complex((r2 * cos(5 * M_PI / 4.0)), (r2 * sin(5 * M_PI / 4.0)));
-          m_32apsk[21] = gr_complex((r2 * cos(17 * M_PI / 12.0)), (r2 * sin(17 * M_PI / 12.0)));
-          m_32apsk[22] = gr_complex((r2 * cos(7 * M_PI / 4.0)), (r2 * sin(7 * M_PI / 4.0)));
-          m_32apsk[23] = gr_complex((r2 * cos(19 * M_PI / 12.0)), (r2 * sin(19 * M_PI / 12.0)));
-          m_32apsk[24] = gr_complex((r3 * cos(19 * M_PI / 16.0)), (r3 * sin(19 * M_PI / 16.0)));
-          m_32apsk[25] = gr_complex((r3 * cos(17 * M_PI / 16.0)), (r3 * sin(17 * M_PI / 16.0)));
-          m_32apsk[26] = gr_complex((r3 * cos(29 * M_PI / 16.0)), (r3 * sin(29 * M_PI / 16.0)));
-          m_32apsk[27] = gr_complex((r3 * cos(31 * M_PI / 16.0)), (r3 * sin(31 * M_PI / 16.0)));
-          m_32apsk[28] = gr_complex((r2 * cos(13 * M_PI / 12.0)), (r2 * sin(13 * M_PI / 12.0)));
-          m_32apsk[29] = gr_complex((r1 * cos(5 * M_PI / 4.0)), (r1 * sin(5 * M_PI / 4.0)));
-          m_32apsk[30] = gr_complex((r2 * cos(23 * M_PI / 12.0)), (r2 * sin(23 * M_PI / 12.0)));
-          m_32apsk[31] = gr_complex((r1 * cos(7 * M_PI / 4.0)), (r1 * sin(7 * M_PI / 4.0)));
+          m_32apsk[0] = gr_complex((r3 * cos(11 * GR_M_PI / 16.0)), (r3 * sin(11 * GR_M_PI / 16.0)));
+          m_32apsk[1] = gr_complex((r3 * cos(9 * GR_M_PI / 16.0)), (r3 * sin(9 * GR_M_PI / 16.0)));
+          m_32apsk[2] = gr_complex((r3 * cos(5 * GR_M_PI / 16.0)), (r3 * sin(5 * GR_M_PI / 16.0)));
+          m_32apsk[3] = gr_complex((r3 * cos(7 * GR_M_PI / 16.0)), (r3 * sin(7 * GR_M_PI / 16.0)));
+          m_32apsk[4] = gr_complex((r2 * cos(3 * GR_M_PI / 4.0)), (r2 * sin(3 * GR_M_PI / 4.0)));
+          m_32apsk[5] = gr_complex((r2 * cos(7 * GR_M_PI / 12.0)), (r2 * sin(7 * GR_M_PI / 12.0)));
+          m_32apsk[6] = gr_complex((r2 * cos(GR_M_PI / 4.0)), (r2 * sin(GR_M_PI / 4.0)));
+          m_32apsk[7] = gr_complex((r2 * cos(5 * GR_M_PI / 12.0)), (r2 * sin(5 * GR_M_PI / 12.0)));
+          m_32apsk[8] = gr_complex((r3 * cos(13 * GR_M_PI / 16.0)), (r3 * sin(13 * GR_M_PI / 16.0)));
+          m_32apsk[9] = gr_complex((r3 * cos(15 * GR_M_PI / 16.0)), (r3 * sin(15 * GR_M_PI / 16.0)));
+          m_32apsk[10] = gr_complex((r3 * cos(3 * GR_M_PI / 16.0)), (r3 * sin(3 * GR_M_PI / 16.0)));
+          m_32apsk[11] = gr_complex((r3 * cos(GR_M_PI / 16.0)), (r3 * sin(GR_M_PI / 16.0)));
+          m_32apsk[12] = gr_complex((r2 * cos(11 * GR_M_PI / 12.0)), (r2 * sin(11 * GR_M_PI / 12.0)));
+          m_32apsk[13] = gr_complex((r1 * cos(3 * GR_M_PI / 4.0)), (r1 * sin(3 * GR_M_PI / 4.0)));
+          m_32apsk[14] = gr_complex((r2 * cos(GR_M_PI / 12.0)), (r2 * sin(GR_M_PI / 12.0)));
+          m_32apsk[15] = gr_complex((r1 * cos(GR_M_PI / 4.0)), (r1 * sin(GR_M_PI / 4.0)));
+          m_32apsk[16] = gr_complex((r3 * cos(21 * GR_M_PI / 16.0)), (r3 * sin(21 * GR_M_PI / 16.0)));
+          m_32apsk[17] = gr_complex((r3 * cos(23 * GR_M_PI / 16.0)), (r3 * sin(23 * GR_M_PI / 16.0)));
+          m_32apsk[18] = gr_complex((r3 * cos(27 * GR_M_PI / 16.0)), (r3 * sin(27 * GR_M_PI / 16.0)));
+          m_32apsk[19] = gr_complex((r3 * cos(25 * GR_M_PI / 16.0)), (r3 * sin(25 * GR_M_PI / 16.0)));
+          m_32apsk[20] = gr_complex((r2 * cos(5 * GR_M_PI / 4.0)), (r2 * sin(5 * GR_M_PI / 4.0)));
+          m_32apsk[21] = gr_complex((r2 * cos(17 * GR_M_PI / 12.0)), (r2 * sin(17 * GR_M_PI / 12.0)));
+          m_32apsk[22] = gr_complex((r2 * cos(7 * GR_M_PI / 4.0)), (r2 * sin(7 * GR_M_PI / 4.0)));
+          m_32apsk[23] = gr_complex((r2 * cos(19 * GR_M_PI / 12.0)), (r2 * sin(19 * GR_M_PI / 12.0)));
+          m_32apsk[24] = gr_complex((r3 * cos(19 * GR_M_PI / 16.0)), (r3 * sin(19 * GR_M_PI / 16.0)));
+          m_32apsk[25] = gr_complex((r3 * cos(17 * GR_M_PI / 16.0)), (r3 * sin(17 * GR_M_PI / 16.0)));
+          m_32apsk[26] = gr_complex((r3 * cos(29 * GR_M_PI / 16.0)), (r3 * sin(29 * GR_M_PI / 16.0)));
+          m_32apsk[27] = gr_complex((r3 * cos(31 * GR_M_PI / 16.0)), (r3 * sin(31 * GR_M_PI / 16.0)));
+          m_32apsk[28] = gr_complex((r2 * cos(13 * GR_M_PI / 12.0)), (r2 * sin(13 * GR_M_PI / 12.0)));
+          m_32apsk[29] = gr_complex((r1 * cos(5 * GR_M_PI / 4.0)), (r1 * sin(5 * GR_M_PI / 4.0)));
+          m_32apsk[30] = gr_complex((r2 * cos(23 * GR_M_PI / 12.0)), (r2 * sin(23 * GR_M_PI / 12.0)));
+          m_32apsk[31] = gr_complex((r1 * cos(7 * GR_M_PI / 4.0)), (r1 * sin(7 * GR_M_PI / 4.0)));
           break;
         case MOD_4_8_4_16APSK:
           r4 = m;
@@ -409,38 +410,38 @@ namespace gr {
               r3 = 0;
               break;
           }
-          m_32apsk[0] = gr_complex((r1 * cos(M_PI / 4.0)), (r1 * sin(M_PI / 4.0)));
-          m_32apsk[1] = gr_complex((r4 * cos(7 * M_PI / 16.0)), (r4 * sin(7 * M_PI / 16.0)));
-          m_32apsk[2] = gr_complex((r1 * cos(7 * M_PI / 4.0)), (r1 * sin(7 * M_PI / 4.0)));
-          m_32apsk[3] = gr_complex((r4 * cos(25 * M_PI / 16.0)), (r4 * sin(25 * M_PI / 16.0)));
-          m_32apsk[4] = gr_complex((r1 * cos(3 * M_PI / 4.0)), (r1 * sin(3 * M_PI / 4.0)));
-          m_32apsk[5] = gr_complex((r4 * cos(9 * M_PI / 16.0)), (r4 * sin(9 * M_PI / 16.0)));
-          m_32apsk[6] = gr_complex((r1 * cos(5 * M_PI / 4.0)), (r1 * sin(5 * M_PI / 4.0)));
-          m_32apsk[7] = gr_complex((r4 * cos(23 * M_PI / 16.0)), (r4 * sin(23 * M_PI / 16.0)));
-          m_32apsk[8] = gr_complex((r2 * cos(M_PI / 12.0)), (r2 * sin(M_PI / 12.0)));
-          m_32apsk[9] = gr_complex((r4 * cos(M_PI / 16.0)), (r4 * sin(M_PI / 16.0)));
-          m_32apsk[10] = gr_complex((r2 * cos(23 * M_PI / 12.0)), (r2 * sin(23 * M_PI / 12.0)));
-          m_32apsk[11] = gr_complex((r4 * cos(31 * M_PI / 16.0)), (r4 * sin(31 * M_PI / 16.0)));
-          m_32apsk[12] = gr_complex((r2 * cos(11 * M_PI / 12.0)), (r2 * sin(11 * M_PI / 12.0)));
-          m_32apsk[13] = gr_complex((r4 * cos(15 * M_PI / 16.0)), (r4 * sin(15 * M_PI / 16.0)));
-          m_32apsk[14] = gr_complex((r2 * cos(13 * M_PI / 12.0)), (r2 * sin(13 * M_PI / 12.0)));
-          m_32apsk[15] = gr_complex((r4 * cos(17 * M_PI / 16.0)), (r4 * sin(17 * M_PI / 16.0)));
-          m_32apsk[16] = gr_complex((r2 * cos(5 * M_PI / 12.0)), (r2 * sin(5 * M_PI / 12.0)));
-          m_32apsk[17] = gr_complex((r4 * cos(5 * M_PI / 16.0)), (r4 * sin(5 * M_PI / 16.0)));
-          m_32apsk[18] = gr_complex((r2 * cos(19 * M_PI / 12.0)), (r2 * sin(19 * M_PI / 12.0)));
-          m_32apsk[19] = gr_complex((r4 * cos(27 * M_PI / 16.0)), (r4 * sin(27 * M_PI / 16.0)));
-          m_32apsk[20] = gr_complex((r2 * cos(7 * M_PI / 12.0)), (r2 * sin(7 * M_PI / 12.0)));
-          m_32apsk[21] = gr_complex((r4 * cos(11 * M_PI / 16.0)), (r4 * sin(11 * M_PI / 16.0)));
-          m_32apsk[22] = gr_complex((r2 * cos(17 * M_PI / 12.0)), (r2 * sin(17 * M_PI / 12.0)));
-          m_32apsk[23] = gr_complex((r4 * cos(21 * M_PI / 16.0)), (r4 * sin(21 * M_PI / 16.0)));
-          m_32apsk[24] = gr_complex((r3 * cos(M_PI / 4.0)), (r3 * sin(M_PI / 4.0)));
-          m_32apsk[25] = gr_complex((r4 * cos(3 * M_PI / 16.0)), (r4 * sin(3 * M_PI / 16.0)));
-          m_32apsk[26] = gr_complex((r3 * cos(7 * M_PI / 4.0)), (r3 * sin(7 * M_PI / 4.0)));
-          m_32apsk[27] = gr_complex((r4 * cos(29 * M_PI / 16.0)), (r4 * sin(29 * M_PI / 16.0)));
-          m_32apsk[28] = gr_complex((r3 * cos(3 * M_PI / 4.0)), (r3 * sin(3 * M_PI / 4.0)));
-          m_32apsk[29] = gr_complex((r4 * cos(13 * M_PI / 16.0)), (r4 * sin(13 * M_PI / 16.0)));
-          m_32apsk[30] = gr_complex((r3 * cos(5 * M_PI / 4.0)), (r3 * sin(5 * M_PI / 4.0)));
-          m_32apsk[31] = gr_complex((r4 * cos(19 * M_PI / 16.0)), (r4 * sin(19 * M_PI / 16.0)));
+          m_32apsk[0] = gr_complex((r1 * cos(GR_M_PI / 4.0)), (r1 * sin(GR_M_PI / 4.0)));
+          m_32apsk[1] = gr_complex((r4 * cos(7 * GR_M_PI / 16.0)), (r4 * sin(7 * GR_M_PI / 16.0)));
+          m_32apsk[2] = gr_complex((r1 * cos(7 * GR_M_PI / 4.0)), (r1 * sin(7 * GR_M_PI / 4.0)));
+          m_32apsk[3] = gr_complex((r4 * cos(25 * GR_M_PI / 16.0)), (r4 * sin(25 * GR_M_PI / 16.0)));
+          m_32apsk[4] = gr_complex((r1 * cos(3 * GR_M_PI / 4.0)), (r1 * sin(3 * GR_M_PI / 4.0)));
+          m_32apsk[5] = gr_complex((r4 * cos(9 * GR_M_PI / 16.0)), (r4 * sin(9 * GR_M_PI / 16.0)));
+          m_32apsk[6] = gr_complex((r1 * cos(5 * GR_M_PI / 4.0)), (r1 * sin(5 * GR_M_PI / 4.0)));
+          m_32apsk[7] = gr_complex((r4 * cos(23 * GR_M_PI / 16.0)), (r4 * sin(23 * GR_M_PI / 16.0)));
+          m_32apsk[8] = gr_complex((r2 * cos(GR_M_PI / 12.0)), (r2 * sin(GR_M_PI / 12.0)));
+          m_32apsk[9] = gr_complex((r4 * cos(GR_M_PI / 16.0)), (r4 * sin(GR_M_PI / 16.0)));
+          m_32apsk[10] = gr_complex((r2 * cos(23 * GR_M_PI / 12.0)), (r2 * sin(23 * GR_M_PI / 12.0)));
+          m_32apsk[11] = gr_complex((r4 * cos(31 * GR_M_PI / 16.0)), (r4 * sin(31 * GR_M_PI / 16.0)));
+          m_32apsk[12] = gr_complex((r2 * cos(11 * GR_M_PI / 12.0)), (r2 * sin(11 * GR_M_PI / 12.0)));
+          m_32apsk[13] = gr_complex((r4 * cos(15 * GR_M_PI / 16.0)), (r4 * sin(15 * GR_M_PI / 16.0)));
+          m_32apsk[14] = gr_complex((r2 * cos(13 * GR_M_PI / 12.0)), (r2 * sin(13 * GR_M_PI / 12.0)));
+          m_32apsk[15] = gr_complex((r4 * cos(17 * GR_M_PI / 16.0)), (r4 * sin(17 * GR_M_PI / 16.0)));
+          m_32apsk[16] = gr_complex((r2 * cos(5 * GR_M_PI / 12.0)), (r2 * sin(5 * GR_M_PI / 12.0)));
+          m_32apsk[17] = gr_complex((r4 * cos(5 * GR_M_PI / 16.0)), (r4 * sin(5 * GR_M_PI / 16.0)));
+          m_32apsk[18] = gr_complex((r2 * cos(19 * GR_M_PI / 12.0)), (r2 * sin(19 * GR_M_PI / 12.0)));
+          m_32apsk[19] = gr_complex((r4 * cos(27 * GR_M_PI / 16.0)), (r4 * sin(27 * GR_M_PI / 16.0)));
+          m_32apsk[20] = gr_complex((r2 * cos(7 * GR_M_PI / 12.0)), (r2 * sin(7 * GR_M_PI / 12.0)));
+          m_32apsk[21] = gr_complex((r4 * cos(11 * GR_M_PI / 16.0)), (r4 * sin(11 * GR_M_PI / 16.0)));
+          m_32apsk[22] = gr_complex((r2 * cos(17 * GR_M_PI / 12.0)), (r2 * sin(17 * GR_M_PI / 12.0)));
+          m_32apsk[23] = gr_complex((r4 * cos(21 * GR_M_PI / 16.0)), (r4 * sin(21 * GR_M_PI / 16.0)));
+          m_32apsk[24] = gr_complex((r3 * cos(GR_M_PI / 4.0)), (r3 * sin(GR_M_PI / 4.0)));
+          m_32apsk[25] = gr_complex((r4 * cos(3 * GR_M_PI / 16.0)), (r4 * sin(3 * GR_M_PI / 16.0)));
+          m_32apsk[26] = gr_complex((r3 * cos(7 * GR_M_PI / 4.0)), (r3 * sin(7 * GR_M_PI / 4.0)));
+          m_32apsk[27] = gr_complex((r4 * cos(29 * GR_M_PI / 16.0)), (r4 * sin(29 * GR_M_PI / 16.0)));
+          m_32apsk[28] = gr_complex((r3 * cos(3 * GR_M_PI / 4.0)), (r3 * sin(3 * GR_M_PI / 4.0)));
+          m_32apsk[29] = gr_complex((r4 * cos(13 * GR_M_PI / 16.0)), (r4 * sin(13 * GR_M_PI / 16.0)));
+          m_32apsk[30] = gr_complex((r3 * cos(5 * GR_M_PI / 4.0)), (r3 * sin(5 * GR_M_PI / 4.0)));
+          m_32apsk[31] = gr_complex((r4 * cos(19 * GR_M_PI / 16.0)), (r4 * sin(19 * GR_M_PI / 16.0)));
           break;
         case MOD_64APSK:
           r4 = m;
@@ -456,70 +457,70 @@ namespace gr {
               r3 = 0;
               break;
           }
-          m_64apsk[0] = gr_complex((r1 * cos(M_PI / 16.0)), (r1 * sin(M_PI / 16.0)));
-          m_64apsk[1] = gr_complex((r1 * cos(3 * M_PI / 16.0)), (r1 * sin(3 * M_PI / 16.0)));
-          m_64apsk[2] = gr_complex((r1 * cos(7 * M_PI / 16.0)), (r1 * sin(7 * M_PI / 16.0)));
-          m_64apsk[3] = gr_complex((r1 * cos(5 * M_PI / 16.0)), (r1 * sin(5 * M_PI / 16.0)));
-          m_64apsk[4] = gr_complex((r1 * cos(31 * M_PI / 16.0)), (r1 * sin(31 * M_PI / 16.0)));
-          m_64apsk[5] = gr_complex((r1 * cos(29 * M_PI / 16.0)), (r1 * sin(29 * M_PI / 16.0)));
-          m_64apsk[6] = gr_complex((r1 * cos(25 * M_PI / 16.0)), (r1 * sin(25 * M_PI / 16.0)));
-          m_64apsk[7] = gr_complex((r1 * cos(27 * M_PI / 16.0)), (r1 * sin(27 * M_PI / 16.0)));
-          m_64apsk[8] = gr_complex((r1 * cos(15 * M_PI / 16.0)), (r1 * sin(15 * M_PI / 16.0)));
-          m_64apsk[9] = gr_complex((r1 * cos(13 * M_PI / 16.0)), (r1 * sin(13 * M_PI / 16.0)));
-          m_64apsk[10] = gr_complex((r1 * cos(9 * M_PI / 16.0)), (r1 * sin(9 * M_PI / 16.0)));
-          m_64apsk[11] = gr_complex((r1 * cos(11 * M_PI / 16.0)), (r1 * sin(11 * M_PI / 16.0)));
-          m_64apsk[12] = gr_complex((r1 * cos(17 * M_PI / 16.0)), (r1 * sin(17 * M_PI / 16.0)));
-          m_64apsk[13] = gr_complex((r1 * cos(19 * M_PI / 16.0)), (r1 * sin(19 * M_PI / 16.0)));
-          m_64apsk[14] = gr_complex((r1 * cos(23 * M_PI / 16.0)), (r1 * sin(23 * M_PI / 16.0)));
-          m_64apsk[15] = gr_complex((r1 * cos(21 * M_PI / 16.0)), (r1 * sin(21 * M_PI / 16.0)));
-          m_64apsk[16] = gr_complex((r2 * cos(M_PI / 16.0)), (r2 * sin(M_PI / 16.0)));
-          m_64apsk[17] = gr_complex((r2 * cos(3 * M_PI / 16.0)), (r2 * sin(3 * M_PI / 16.0)));
-          m_64apsk[18] = gr_complex((r2 * cos(7 * M_PI / 16.0)), (r2 * sin(7 * M_PI / 16.0)));
-          m_64apsk[19] = gr_complex((r2 * cos(5 * M_PI / 16.0)), (r2 * sin(5 * M_PI / 16.0)));
-          m_64apsk[20] = gr_complex((r2 * cos(31 * M_PI / 16.0)), (r2 * sin(31* M_PI / 16.0)));
-          m_64apsk[21] = gr_complex((r2 * cos(29 * M_PI / 16.0)), (r2 * sin(29 * M_PI / 16.0)));
-          m_64apsk[22] = gr_complex((r2 * cos(25 * M_PI / 16.0)), (r2 * sin(25 * M_PI / 16.0)));
-          m_64apsk[23] = gr_complex((r2 * cos(27 * M_PI / 16.0)), (r2 * sin(27 * M_PI / 16.0)));
-          m_64apsk[24] = gr_complex((r2 * cos(15 * M_PI / 16.0)), (r2 * sin(15 * M_PI / 16.0)));
-          m_64apsk[25] = gr_complex((r2 * cos(13 * M_PI / 16.0)), (r2 * sin(13 * M_PI / 16.0)));
-          m_64apsk[26] = gr_complex((r2 * cos(9 * M_PI / 16.0)), (r2 * sin(9 * M_PI / 16.0)));
-          m_64apsk[27] = gr_complex((r2 * cos(11 * M_PI / 16.0)), (r2 * sin(11 * M_PI / 16.0)));
-          m_64apsk[28] = gr_complex((r2 * cos(17 * M_PI / 16.0)), (r2 * sin(17 * M_PI / 16.0)));
-          m_64apsk[29] = gr_complex((r2 * cos(19 * M_PI / 16.0)), (r2 * sin(19 * M_PI / 16.0)));
-          m_64apsk[30] = gr_complex((r2 * cos(23 * M_PI / 16.0)), (r2 * sin(23 * M_PI / 16.0)));
-          m_64apsk[31] = gr_complex((r2 * cos(21 * M_PI / 16.0)), (r2 * sin(21 * M_PI / 16.0)));
-          m_64apsk[32] = gr_complex((r4 * cos(M_PI / 16.0)), (r4 * sin(M_PI / 16.0)));
-          m_64apsk[33] = gr_complex((r4 * cos(3 * M_PI / 16.0)), (r4 * sin(3 * M_PI / 16.0)));
-          m_64apsk[34] = gr_complex((r4 * cos(7 * M_PI / 16.0)), (r4 * sin(7 * M_PI / 16.0)));
-          m_64apsk[35] = gr_complex((r4 * cos(5 * M_PI / 16.0)), (r4 * sin(5 * M_PI / 16.0)));
-          m_64apsk[36] = gr_complex((r4 * cos(31 * M_PI / 16.0)), (r4 * sin(31 * M_PI / 16.0)));
-          m_64apsk[37] = gr_complex((r4 * cos(29 * M_PI / 16.0)), (r4 * sin(29 * M_PI / 16.0)));
-          m_64apsk[38] = gr_complex((r4 * cos(25 * M_PI / 16.0)), (r4 * sin(25 * M_PI / 16.0)));
-          m_64apsk[39] = gr_complex((r4 * cos(27 * M_PI / 16.0)), (r4 * sin(27 * M_PI / 16.0)));
-          m_64apsk[40] = gr_complex((r4 * cos(15 * M_PI / 16.0)), (r4 * sin(15 * M_PI / 16.0)));
-          m_64apsk[41] = gr_complex((r4 * cos(13 * M_PI / 16.0)), (r4 * sin(13 * M_PI / 16.0)));
-          m_64apsk[42] = gr_complex((r4 * cos(9 * M_PI / 16.0)), (r4 * sin(9 * M_PI / 16.0)));
-          m_64apsk[43] = gr_complex((r4 * cos(11 * M_PI / 16.0)), (r4 * sin(11 * M_PI / 16.0)));
-          m_64apsk[44] = gr_complex((r4 * cos(17 * M_PI / 16.0)), (r4 * sin(17 * M_PI / 16.0)));
-          m_64apsk[45] = gr_complex((r4 * cos(19 * M_PI / 16.0)), (r4 * sin(19 * M_PI / 16.0)));
-          m_64apsk[46] = gr_complex((r4 * cos(23 * M_PI / 16.0)), (r4 * sin(23 * M_PI / 16.0)));
-          m_64apsk[47] = gr_complex((r4 * cos(21 * M_PI / 16.0)), (r4 * sin(21 * M_PI / 16.0)));
-          m_64apsk[48] = gr_complex((r3 * cos(M_PI / 16.0)), (r3 * sin(M_PI / 16.0)));
-          m_64apsk[49] = gr_complex((r3 * cos(3 * M_PI / 16.0)), (r3 * sin(3 * M_PI / 16.0)));
-          m_64apsk[50] = gr_complex((r3 * cos(7 * M_PI / 16.0)), (r3 * sin(7 * M_PI / 16.0)));
-          m_64apsk[51] = gr_complex((r3 * cos(5 * M_PI / 16.0)), (r3 * sin(5 * M_PI / 16.0)));
-          m_64apsk[52] = gr_complex((r3 * cos(31 * M_PI / 16.0)), (r3 * sin(31 * M_PI / 16.0)));
-          m_64apsk[53] = gr_complex((r3 * cos(29 * M_PI / 16.0)), (r3 * sin(29 * M_PI / 16.0)));
-          m_64apsk[54] = gr_complex((r3 * cos(25 * M_PI / 16.0)), (r3 * sin(25 * M_PI / 16.0)));
-          m_64apsk[55] = gr_complex((r3 * cos(27 * M_PI / 16.0)), (r3 * sin(27 * M_PI / 16.0)));
-          m_64apsk[56] = gr_complex((r3 * cos(15 * M_PI / 16.0)), (r3 * sin(15 * M_PI / 16.0)));
-          m_64apsk[57] = gr_complex((r3 * cos(13 * M_PI / 16.0)), (r3 * sin(13 * M_PI / 16.0)));
-          m_64apsk[58] = gr_complex((r3 * cos(9 * M_PI / 16.0)), (r3 * sin(9 * M_PI / 16.0)));
-          m_64apsk[59] = gr_complex((r3 * cos(11 * M_PI / 16.0)), (r3 * sin(11 * M_PI / 16.0)));
-          m_64apsk[60] = gr_complex((r3 * cos(17 * M_PI / 16.0)), (r3 * sin(17 * M_PI / 16.0)));
-          m_64apsk[61] = gr_complex((r3 * cos(19 * M_PI / 16.0)), (r3 * sin(19 * M_PI / 16.0)));
-          m_64apsk[62] = gr_complex((r3 * cos(23 * M_PI / 16.0)), (r3 * sin(23 * M_PI / 16.0)));
-          m_64apsk[63] = gr_complex((r3 * cos(21 * M_PI / 16.0)), (r3 * sin(21 * M_PI / 16.0)));
+          m_64apsk[0] = gr_complex((r1 * cos(GR_M_PI / 16.0)), (r1 * sin(GR_M_PI / 16.0)));
+          m_64apsk[1] = gr_complex((r1 * cos(3 * GR_M_PI / 16.0)), (r1 * sin(3 * GR_M_PI / 16.0)));
+          m_64apsk[2] = gr_complex((r1 * cos(7 * GR_M_PI / 16.0)), (r1 * sin(7 * GR_M_PI / 16.0)));
+          m_64apsk[3] = gr_complex((r1 * cos(5 * GR_M_PI / 16.0)), (r1 * sin(5 * GR_M_PI / 16.0)));
+          m_64apsk[4] = gr_complex((r1 * cos(31 * GR_M_PI / 16.0)), (r1 * sin(31 * GR_M_PI / 16.0)));
+          m_64apsk[5] = gr_complex((r1 * cos(29 * GR_M_PI / 16.0)), (r1 * sin(29 * GR_M_PI / 16.0)));
+          m_64apsk[6] = gr_complex((r1 * cos(25 * GR_M_PI / 16.0)), (r1 * sin(25 * GR_M_PI / 16.0)));
+          m_64apsk[7] = gr_complex((r1 * cos(27 * GR_M_PI / 16.0)), (r1 * sin(27 * GR_M_PI / 16.0)));
+          m_64apsk[8] = gr_complex((r1 * cos(15 * GR_M_PI / 16.0)), (r1 * sin(15 * GR_M_PI / 16.0)));
+          m_64apsk[9] = gr_complex((r1 * cos(13 * GR_M_PI / 16.0)), (r1 * sin(13 * GR_M_PI / 16.0)));
+          m_64apsk[10] = gr_complex((r1 * cos(9 * GR_M_PI / 16.0)), (r1 * sin(9 * GR_M_PI / 16.0)));
+          m_64apsk[11] = gr_complex((r1 * cos(11 * GR_M_PI / 16.0)), (r1 * sin(11 * GR_M_PI / 16.0)));
+          m_64apsk[12] = gr_complex((r1 * cos(17 * GR_M_PI / 16.0)), (r1 * sin(17 * GR_M_PI / 16.0)));
+          m_64apsk[13] = gr_complex((r1 * cos(19 * GR_M_PI / 16.0)), (r1 * sin(19 * GR_M_PI / 16.0)));
+          m_64apsk[14] = gr_complex((r1 * cos(23 * GR_M_PI / 16.0)), (r1 * sin(23 * GR_M_PI / 16.0)));
+          m_64apsk[15] = gr_complex((r1 * cos(21 * GR_M_PI / 16.0)), (r1 * sin(21 * GR_M_PI / 16.0)));
+          m_64apsk[16] = gr_complex((r2 * cos(GR_M_PI / 16.0)), (r2 * sin(GR_M_PI / 16.0)));
+          m_64apsk[17] = gr_complex((r2 * cos(3 * GR_M_PI / 16.0)), (r2 * sin(3 * GR_M_PI / 16.0)));
+          m_64apsk[18] = gr_complex((r2 * cos(7 * GR_M_PI / 16.0)), (r2 * sin(7 * GR_M_PI / 16.0)));
+          m_64apsk[19] = gr_complex((r2 * cos(5 * GR_M_PI / 16.0)), (r2 * sin(5 * GR_M_PI / 16.0)));
+          m_64apsk[20] = gr_complex((r2 * cos(31 * GR_M_PI / 16.0)), (r2 * sin(31* GR_M_PI / 16.0)));
+          m_64apsk[21] = gr_complex((r2 * cos(29 * GR_M_PI / 16.0)), (r2 * sin(29 * GR_M_PI / 16.0)));
+          m_64apsk[22] = gr_complex((r2 * cos(25 * GR_M_PI / 16.0)), (r2 * sin(25 * GR_M_PI / 16.0)));
+          m_64apsk[23] = gr_complex((r2 * cos(27 * GR_M_PI / 16.0)), (r2 * sin(27 * GR_M_PI / 16.0)));
+          m_64apsk[24] = gr_complex((r2 * cos(15 * GR_M_PI / 16.0)), (r2 * sin(15 * GR_M_PI / 16.0)));
+          m_64apsk[25] = gr_complex((r2 * cos(13 * GR_M_PI / 16.0)), (r2 * sin(13 * GR_M_PI / 16.0)));
+          m_64apsk[26] = gr_complex((r2 * cos(9 * GR_M_PI / 16.0)), (r2 * sin(9 * GR_M_PI / 16.0)));
+          m_64apsk[27] = gr_complex((r2 * cos(11 * GR_M_PI / 16.0)), (r2 * sin(11 * GR_M_PI / 16.0)));
+          m_64apsk[28] = gr_complex((r2 * cos(17 * GR_M_PI / 16.0)), (r2 * sin(17 * GR_M_PI / 16.0)));
+          m_64apsk[29] = gr_complex((r2 * cos(19 * GR_M_PI / 16.0)), (r2 * sin(19 * GR_M_PI / 16.0)));
+          m_64apsk[30] = gr_complex((r2 * cos(23 * GR_M_PI / 16.0)), (r2 * sin(23 * GR_M_PI / 16.0)));
+          m_64apsk[31] = gr_complex((r2 * cos(21 * GR_M_PI / 16.0)), (r2 * sin(21 * GR_M_PI / 16.0)));
+          m_64apsk[32] = gr_complex((r4 * cos(GR_M_PI / 16.0)), (r4 * sin(GR_M_PI / 16.0)));
+          m_64apsk[33] = gr_complex((r4 * cos(3 * GR_M_PI / 16.0)), (r4 * sin(3 * GR_M_PI / 16.0)));
+          m_64apsk[34] = gr_complex((r4 * cos(7 * GR_M_PI / 16.0)), (r4 * sin(7 * GR_M_PI / 16.0)));
+          m_64apsk[35] = gr_complex((r4 * cos(5 * GR_M_PI / 16.0)), (r4 * sin(5 * GR_M_PI / 16.0)));
+          m_64apsk[36] = gr_complex((r4 * cos(31 * GR_M_PI / 16.0)), (r4 * sin(31 * GR_M_PI / 16.0)));
+          m_64apsk[37] = gr_complex((r4 * cos(29 * GR_M_PI / 16.0)), (r4 * sin(29 * GR_M_PI / 16.0)));
+          m_64apsk[38] = gr_complex((r4 * cos(25 * GR_M_PI / 16.0)), (r4 * sin(25 * GR_M_PI / 16.0)));
+          m_64apsk[39] = gr_complex((r4 * cos(27 * GR_M_PI / 16.0)), (r4 * sin(27 * GR_M_PI / 16.0)));
+          m_64apsk[40] = gr_complex((r4 * cos(15 * GR_M_PI / 16.0)), (r4 * sin(15 * GR_M_PI / 16.0)));
+          m_64apsk[41] = gr_complex((r4 * cos(13 * GR_M_PI / 16.0)), (r4 * sin(13 * GR_M_PI / 16.0)));
+          m_64apsk[42] = gr_complex((r4 * cos(9 * GR_M_PI / 16.0)), (r4 * sin(9 * GR_M_PI / 16.0)));
+          m_64apsk[43] = gr_complex((r4 * cos(11 * GR_M_PI / 16.0)), (r4 * sin(11 * GR_M_PI / 16.0)));
+          m_64apsk[44] = gr_complex((r4 * cos(17 * GR_M_PI / 16.0)), (r4 * sin(17 * GR_M_PI / 16.0)));
+          m_64apsk[45] = gr_complex((r4 * cos(19 * GR_M_PI / 16.0)), (r4 * sin(19 * GR_M_PI / 16.0)));
+          m_64apsk[46] = gr_complex((r4 * cos(23 * GR_M_PI / 16.0)), (r4 * sin(23 * GR_M_PI / 16.0)));
+          m_64apsk[47] = gr_complex((r4 * cos(21 * GR_M_PI / 16.0)), (r4 * sin(21 * GR_M_PI / 16.0)));
+          m_64apsk[48] = gr_complex((r3 * cos(GR_M_PI / 16.0)), (r3 * sin(GR_M_PI / 16.0)));
+          m_64apsk[49] = gr_complex((r3 * cos(3 * GR_M_PI / 16.0)), (r3 * sin(3 * GR_M_PI / 16.0)));
+          m_64apsk[50] = gr_complex((r3 * cos(7 * GR_M_PI / 16.0)), (r3 * sin(7 * GR_M_PI / 16.0)));
+          m_64apsk[51] = gr_complex((r3 * cos(5 * GR_M_PI / 16.0)), (r3 * sin(5 * GR_M_PI / 16.0)));
+          m_64apsk[52] = gr_complex((r3 * cos(31 * GR_M_PI / 16.0)), (r3 * sin(31 * GR_M_PI / 16.0)));
+          m_64apsk[53] = gr_complex((r3 * cos(29 * GR_M_PI / 16.0)), (r3 * sin(29 * GR_M_PI / 16.0)));
+          m_64apsk[54] = gr_complex((r3 * cos(25 * GR_M_PI / 16.0)), (r3 * sin(25 * GR_M_PI / 16.0)));
+          m_64apsk[55] = gr_complex((r3 * cos(27 * GR_M_PI / 16.0)), (r3 * sin(27 * GR_M_PI / 16.0)));
+          m_64apsk[56] = gr_complex((r3 * cos(15 * GR_M_PI / 16.0)), (r3 * sin(15 * GR_M_PI / 16.0)));
+          m_64apsk[57] = gr_complex((r3 * cos(13 * GR_M_PI / 16.0)), (r3 * sin(13 * GR_M_PI / 16.0)));
+          m_64apsk[58] = gr_complex((r3 * cos(9 * GR_M_PI / 16.0)), (r3 * sin(9 * GR_M_PI / 16.0)));
+          m_64apsk[59] = gr_complex((r3 * cos(11 * GR_M_PI / 16.0)), (r3 * sin(11 * GR_M_PI / 16.0)));
+          m_64apsk[60] = gr_complex((r3 * cos(17 * GR_M_PI / 16.0)), (r3 * sin(17 * GR_M_PI / 16.0)));
+          m_64apsk[61] = gr_complex((r3 * cos(19 * GR_M_PI / 16.0)), (r3 * sin(19 * GR_M_PI / 16.0)));
+          m_64apsk[62] = gr_complex((r3 * cos(23 * GR_M_PI / 16.0)), (r3 * sin(23 * GR_M_PI / 16.0)));
+          m_64apsk[63] = gr_complex((r3 * cos(21 * GR_M_PI / 16.0)), (r3 * sin(21 * GR_M_PI / 16.0)));
           break;
         case MOD_8_16_20_20APSK:
           r4 = m;
@@ -541,70 +542,70 @@ namespace gr {
               r3 = 0;
               break;
           }
-          m_64apsk[0] = gr_complex((r2 * cos(25 * M_PI / 16.0)), (r2 * sin(25 * M_PI / 16.0)));
-          m_64apsk[1] = gr_complex((r4 * cos(7 * M_PI / 4.0)), (r4 * sin(7 * M_PI / 4.0)));
-          m_64apsk[2] = gr_complex((r2 * cos(27 * M_PI / 16.0)), (r2 * sin(27 * M_PI / 16.0)));
-          m_64apsk[3] = gr_complex((r3 * cos(7 * M_PI / 4.0)), (r3 * sin(7 * M_PI / 4.0)));
-          m_64apsk[4] = gr_complex((r4 * cos(31 * M_PI / 20.0)), (r4 * sin(31 * M_PI / 20.0)));
-          m_64apsk[5] = gr_complex((r4 * cos(33 * M_PI / 20.0)), (r4 * sin(33 * M_PI / 20.0)));
-          m_64apsk[6] = gr_complex((r3 * cos(31 * M_PI / 20.0)), (r3 * sin(31 * M_PI / 20.0)));
-          m_64apsk[7] = gr_complex((r3 * cos(33 * M_PI / 20.0)), (r3 * sin(33 * M_PI / 20.0)));
-          m_64apsk[8] = gr_complex((r2 * cos(23 * M_PI / 16.0)), (r2 * sin(23 * M_PI / 16.0)));
-          m_64apsk[9] = gr_complex((r4 * cos(5 * M_PI / 4.0)), (r4 * sin(5 * M_PI / 4.0)));
-          m_64apsk[10] = gr_complex((r2 * cos(21 * M_PI / 16.0)), (r2 * sin(21 * M_PI / 16.0)));
-          m_64apsk[11] = gr_complex((r3 * cos(5 * M_PI / 4.0)), (r3 * sin(5 * M_PI / 4.0)));
-          m_64apsk[12] = gr_complex((r4 * cos(29 * M_PI / 20.0)), (r4 * sin(29 * M_PI / 20.0)));
-          m_64apsk[13] = gr_complex((r4 * cos(27 * M_PI / 20.0)), (r4 * sin(27 * M_PI / 20.0)));
-          m_64apsk[14] = gr_complex((r3 * cos(29 * M_PI / 20.0)), (r3 * sin(29 * M_PI / 20.0)));
-          m_64apsk[15] = gr_complex((r3 * cos(27 * M_PI / 20.0)), (r3 * sin(27 * M_PI / 20.0)));
-          m_64apsk[16] = gr_complex((r1 * cos(13 * M_PI / 8.0)), (r1 * sin(13 * M_PI / 8.0)));
-          m_64apsk[17] = gr_complex((r4 * cos(37 * M_PI / 20.0)), (r4 * sin(37 * M_PI / 20.0)));
-          m_64apsk[18] = gr_complex((r2 * cos(29 * M_PI / 16.0)), (r2 * sin(29 * M_PI / 16.0)));
-          m_64apsk[19] = gr_complex((r3 * cos(37 * M_PI / 20.0)), (r3 * sin(37 * M_PI / 20.0)));
-          m_64apsk[20] = gr_complex((r1 * cos(15 * M_PI / 8.0)), (r1 * sin(15 * M_PI / 8.0)));
-          m_64apsk[21] = gr_complex((r4 * cos(39 * M_PI / 20.0)), (r4 * sin(39 * M_PI / 20.0)));
-          m_64apsk[22] = gr_complex((r2 * cos(31 * M_PI / 16.0)), (r2 * sin(31 * M_PI / 16.0)));
-          m_64apsk[23] = gr_complex((r3 * cos(39 * M_PI / 20.0)), (r3 * sin(39 * M_PI / 20.0)));
-          m_64apsk[24] = gr_complex((r1 * cos(11 * M_PI / 8.0)), (r1 * sin(11 * M_PI / 8.0)));
-          m_64apsk[25] = gr_complex((r4 * cos(23 * M_PI / 20.0)), (r4 * sin(23 * M_PI / 20.0)));
-          m_64apsk[26] = gr_complex((r2 * cos(19 * M_PI / 16.0)), (r2 * sin(19 * M_PI / 16.0)));
-          m_64apsk[27] = gr_complex((r3 * cos(23 * M_PI / 20.0)), (r3 * sin(23 * M_PI / 20.0)));
-          m_64apsk[28] = gr_complex((r1 * cos(9 * M_PI / 8.0)), (r1 * sin(9 * M_PI / 8.0)));
-          m_64apsk[29] = gr_complex((r4 * cos(21 * M_PI / 20.0)), (r4 * sin(21 * M_PI / 20.0)));
-          m_64apsk[30] = gr_complex((r2 * cos(17 * M_PI / 16.0)), (r2 * sin(17 * M_PI / 16.0)));
-          m_64apsk[31] = gr_complex((r3 * cos(21 * M_PI / 20.0)), (r3 * sin(21 * M_PI / 20.0)));
-          m_64apsk[32] = gr_complex((r2 * cos(7 * M_PI / 16.0)), (r2 * sin(7 * M_PI / 16.0)));
-          m_64apsk[33] = gr_complex((r4 * cos(M_PI / 4.0)), (r4 * sin(M_PI / 4.0)));
-          m_64apsk[34] = gr_complex((r2 * cos(5 * M_PI / 16.0)), (r2 * sin(5 * M_PI / 16.0)));
-          m_64apsk[35] = gr_complex((r3 * cos(M_PI / 4.0)), (r3 * sin(M_PI / 4.0)));
-          m_64apsk[36] = gr_complex((r4 * cos(9 * M_PI / 20.0)), (r4 * sin(9 * M_PI / 20.0)));
-          m_64apsk[37] = gr_complex((r4 * cos(7 * M_PI / 20.0)), (r4 * sin(7 * M_PI / 20.0)));
-          m_64apsk[38] = gr_complex((r3 * cos(9 * M_PI / 20.0)), (r3 * sin(9 * M_PI / 20.0)));
-          m_64apsk[39] = gr_complex((r3 * cos(7 * M_PI / 20.0)), (r3 * sin(7 * M_PI / 20.0)));
-          m_64apsk[40] = gr_complex((r2 * cos(9 * M_PI / 16.0)), (r2 * sin(9 * M_PI / 16.0)));
-          m_64apsk[41] = gr_complex((r4 * cos(3 * M_PI / 4.0)), (r4 * sin(3 * M_PI / 4.0)));
-          m_64apsk[42] = gr_complex((r2 * cos(11 * M_PI / 16.0)), (r2 * sin(11 * M_PI / 16.0)));
-          m_64apsk[43] = gr_complex((r3 * cos(3 * M_PI / 4.0)), (r3 * sin(3 * M_PI / 4.0)));
-          m_64apsk[44] = gr_complex((r4 * cos(11 * M_PI / 20.0)), (r4 * sin(11 * M_PI / 20.0)));
-          m_64apsk[45] = gr_complex((r4 * cos(13 * M_PI / 20.0)), (r4 * sin(13 * M_PI / 20.0)));
-          m_64apsk[46] = gr_complex((r3 * cos(11 * M_PI / 20.0)), (r3 * sin(11 * M_PI / 20.0)));
-          m_64apsk[47] = gr_complex((r3 * cos(13 * M_PI / 20.0)), (r3 * sin(13 * M_PI / 20.0)));
-          m_64apsk[48] = gr_complex((r1 * cos(3 * M_PI / 8.0)), (r1 * sin(3 * M_PI / 8.0)));
-          m_64apsk[49] = gr_complex((r4 * cos(3 * M_PI / 20.0)), (r4 * sin(3 * M_PI / 20.0)));
-          m_64apsk[50] = gr_complex((r2 * cos(3 * M_PI / 16.0)), (r2 * sin(3 * M_PI / 16.0)));
-          m_64apsk[51] = gr_complex((r3 * cos(3 * M_PI / 20.0)), (r3 * sin(3 * M_PI / 20.0)));
-          m_64apsk[52] = gr_complex((r1 * cos(M_PI / 8.0)), (r1 * sin(M_PI / 8.0)));
-          m_64apsk[53] = gr_complex((r4 * cos(M_PI / 20.0)), (r4 * sin(M_PI / 20.0)));
-          m_64apsk[54] = gr_complex((r2 * cos(M_PI / 16.0)), (r2 * sin(M_PI / 16.0)));
-          m_64apsk[55] = gr_complex((r3 * cos(M_PI / 20.0)), (r3 * sin(M_PI / 20.0)));
-          m_64apsk[56] = gr_complex((r1 * cos(5 * M_PI / 8.0)), (r1 * sin(5 * M_PI / 8.0)));
-          m_64apsk[57] = gr_complex((r4 * cos(17 * M_PI / 20.0)), (r4 * sin(17 * M_PI / 20.0)));
-          m_64apsk[58] = gr_complex((r2 * cos(13 * M_PI / 16.0)), (r2 * sin(13 * M_PI / 16.0)));
-          m_64apsk[59] = gr_complex((r3 * cos(17 * M_PI / 20.0)), (r3 * sin(17 * M_PI / 20.0)));
-          m_64apsk[60] = gr_complex((r1 * cos(7 * M_PI / 8.0)), (r1 * sin(7 * M_PI / 8.0)));
-          m_64apsk[61] = gr_complex((r4 * cos(19 * M_PI / 20.0)), (r4 * sin(19 * M_PI / 20.0)));
-          m_64apsk[62] = gr_complex((r2 * cos(15 * M_PI / 16.0)), (r2 * sin(15 * M_PI / 16.0)));
-          m_64apsk[63] = gr_complex((r3 * cos(19 * M_PI / 20.0)), (r3 * sin(19 * M_PI / 20.0)));
+          m_64apsk[0] = gr_complex((r2 * cos(25 * GR_M_PI / 16.0)), (r2 * sin(25 * GR_M_PI / 16.0)));
+          m_64apsk[1] = gr_complex((r4 * cos(7 * GR_M_PI / 4.0)), (r4 * sin(7 * GR_M_PI / 4.0)));
+          m_64apsk[2] = gr_complex((r2 * cos(27 * GR_M_PI / 16.0)), (r2 * sin(27 * GR_M_PI / 16.0)));
+          m_64apsk[3] = gr_complex((r3 * cos(7 * GR_M_PI / 4.0)), (r3 * sin(7 * GR_M_PI / 4.0)));
+          m_64apsk[4] = gr_complex((r4 * cos(31 * GR_M_PI / 20.0)), (r4 * sin(31 * GR_M_PI / 20.0)));
+          m_64apsk[5] = gr_complex((r4 * cos(33 * GR_M_PI / 20.0)), (r4 * sin(33 * GR_M_PI / 20.0)));
+          m_64apsk[6] = gr_complex((r3 * cos(31 * GR_M_PI / 20.0)), (r3 * sin(31 * GR_M_PI / 20.0)));
+          m_64apsk[7] = gr_complex((r3 * cos(33 * GR_M_PI / 20.0)), (r3 * sin(33 * GR_M_PI / 20.0)));
+          m_64apsk[8] = gr_complex((r2 * cos(23 * GR_M_PI / 16.0)), (r2 * sin(23 * GR_M_PI / 16.0)));
+          m_64apsk[9] = gr_complex((r4 * cos(5 * GR_M_PI / 4.0)), (r4 * sin(5 * GR_M_PI / 4.0)));
+          m_64apsk[10] = gr_complex((r2 * cos(21 * GR_M_PI / 16.0)), (r2 * sin(21 * GR_M_PI / 16.0)));
+          m_64apsk[11] = gr_complex((r3 * cos(5 * GR_M_PI / 4.0)), (r3 * sin(5 * GR_M_PI / 4.0)));
+          m_64apsk[12] = gr_complex((r4 * cos(29 * GR_M_PI / 20.0)), (r4 * sin(29 * GR_M_PI / 20.0)));
+          m_64apsk[13] = gr_complex((r4 * cos(27 * GR_M_PI / 20.0)), (r4 * sin(27 * GR_M_PI / 20.0)));
+          m_64apsk[14] = gr_complex((r3 * cos(29 * GR_M_PI / 20.0)), (r3 * sin(29 * GR_M_PI / 20.0)));
+          m_64apsk[15] = gr_complex((r3 * cos(27 * GR_M_PI / 20.0)), (r3 * sin(27 * GR_M_PI / 20.0)));
+          m_64apsk[16] = gr_complex((r1 * cos(13 * GR_M_PI / 8.0)), (r1 * sin(13 * GR_M_PI / 8.0)));
+          m_64apsk[17] = gr_complex((r4 * cos(37 * GR_M_PI / 20.0)), (r4 * sin(37 * GR_M_PI / 20.0)));
+          m_64apsk[18] = gr_complex((r2 * cos(29 * GR_M_PI / 16.0)), (r2 * sin(29 * GR_M_PI / 16.0)));
+          m_64apsk[19] = gr_complex((r3 * cos(37 * GR_M_PI / 20.0)), (r3 * sin(37 * GR_M_PI / 20.0)));
+          m_64apsk[20] = gr_complex((r1 * cos(15 * GR_M_PI / 8.0)), (r1 * sin(15 * GR_M_PI / 8.0)));
+          m_64apsk[21] = gr_complex((r4 * cos(39 * GR_M_PI / 20.0)), (r4 * sin(39 * GR_M_PI / 20.0)));
+          m_64apsk[22] = gr_complex((r2 * cos(31 * GR_M_PI / 16.0)), (r2 * sin(31 * GR_M_PI / 16.0)));
+          m_64apsk[23] = gr_complex((r3 * cos(39 * GR_M_PI / 20.0)), (r3 * sin(39 * GR_M_PI / 20.0)));
+          m_64apsk[24] = gr_complex((r1 * cos(11 * GR_M_PI / 8.0)), (r1 * sin(11 * GR_M_PI / 8.0)));
+          m_64apsk[25] = gr_complex((r4 * cos(23 * GR_M_PI / 20.0)), (r4 * sin(23 * GR_M_PI / 20.0)));
+          m_64apsk[26] = gr_complex((r2 * cos(19 * GR_M_PI / 16.0)), (r2 * sin(19 * GR_M_PI / 16.0)));
+          m_64apsk[27] = gr_complex((r3 * cos(23 * GR_M_PI / 20.0)), (r3 * sin(23 * GR_M_PI / 20.0)));
+          m_64apsk[28] = gr_complex((r1 * cos(9 * GR_M_PI / 8.0)), (r1 * sin(9 * GR_M_PI / 8.0)));
+          m_64apsk[29] = gr_complex((r4 * cos(21 * GR_M_PI / 20.0)), (r4 * sin(21 * GR_M_PI / 20.0)));
+          m_64apsk[30] = gr_complex((r2 * cos(17 * GR_M_PI / 16.0)), (r2 * sin(17 * GR_M_PI / 16.0)));
+          m_64apsk[31] = gr_complex((r3 * cos(21 * GR_M_PI / 20.0)), (r3 * sin(21 * GR_M_PI / 20.0)));
+          m_64apsk[32] = gr_complex((r2 * cos(7 * GR_M_PI / 16.0)), (r2 * sin(7 * GR_M_PI / 16.0)));
+          m_64apsk[33] = gr_complex((r4 * cos(GR_M_PI / 4.0)), (r4 * sin(GR_M_PI / 4.0)));
+          m_64apsk[34] = gr_complex((r2 * cos(5 * GR_M_PI / 16.0)), (r2 * sin(5 * GR_M_PI / 16.0)));
+          m_64apsk[35] = gr_complex((r3 * cos(GR_M_PI / 4.0)), (r3 * sin(GR_M_PI / 4.0)));
+          m_64apsk[36] = gr_complex((r4 * cos(9 * GR_M_PI / 20.0)), (r4 * sin(9 * GR_M_PI / 20.0)));
+          m_64apsk[37] = gr_complex((r4 * cos(7 * GR_M_PI / 20.0)), (r4 * sin(7 * GR_M_PI / 20.0)));
+          m_64apsk[38] = gr_complex((r3 * cos(9 * GR_M_PI / 20.0)), (r3 * sin(9 * GR_M_PI / 20.0)));
+          m_64apsk[39] = gr_complex((r3 * cos(7 * GR_M_PI / 20.0)), (r3 * sin(7 * GR_M_PI / 20.0)));
+          m_64apsk[40] = gr_complex((r2 * cos(9 * GR_M_PI / 16.0)), (r2 * sin(9 * GR_M_PI / 16.0)));
+          m_64apsk[41] = gr_complex((r4 * cos(3 * GR_M_PI / 4.0)), (r4 * sin(3 * GR_M_PI / 4.0)));
+          m_64apsk[42] = gr_complex((r2 * cos(11 * GR_M_PI / 16.0)), (r2 * sin(11 * GR_M_PI / 16.0)));
+          m_64apsk[43] = gr_complex((r3 * cos(3 * GR_M_PI / 4.0)), (r3 * sin(3 * GR_M_PI / 4.0)));
+          m_64apsk[44] = gr_complex((r4 * cos(11 * GR_M_PI / 20.0)), (r4 * sin(11 * GR_M_PI / 20.0)));
+          m_64apsk[45] = gr_complex((r4 * cos(13 * GR_M_PI / 20.0)), (r4 * sin(13 * GR_M_PI / 20.0)));
+          m_64apsk[46] = gr_complex((r3 * cos(11 * GR_M_PI / 20.0)), (r3 * sin(11 * GR_M_PI / 20.0)));
+          m_64apsk[47] = gr_complex((r3 * cos(13 * GR_M_PI / 20.0)), (r3 * sin(13 * GR_M_PI / 20.0)));
+          m_64apsk[48] = gr_complex((r1 * cos(3 * GR_M_PI / 8.0)), (r1 * sin(3 * GR_M_PI / 8.0)));
+          m_64apsk[49] = gr_complex((r4 * cos(3 * GR_M_PI / 20.0)), (r4 * sin(3 * GR_M_PI / 20.0)));
+          m_64apsk[50] = gr_complex((r2 * cos(3 * GR_M_PI / 16.0)), (r2 * sin(3 * GR_M_PI / 16.0)));
+          m_64apsk[51] = gr_complex((r3 * cos(3 * GR_M_PI / 20.0)), (r3 * sin(3 * GR_M_PI / 20.0)));
+          m_64apsk[52] = gr_complex((r1 * cos(GR_M_PI / 8.0)), (r1 * sin(GR_M_PI / 8.0)));
+          m_64apsk[53] = gr_complex((r4 * cos(GR_M_PI / 20.0)), (r4 * sin(GR_M_PI / 20.0)));
+          m_64apsk[54] = gr_complex((r2 * cos(GR_M_PI / 16.0)), (r2 * sin(GR_M_PI / 16.0)));
+          m_64apsk[55] = gr_complex((r3 * cos(GR_M_PI / 20.0)), (r3 * sin(GR_M_PI / 20.0)));
+          m_64apsk[56] = gr_complex((r1 * cos(5 * GR_M_PI / 8.0)), (r1 * sin(5 * GR_M_PI / 8.0)));
+          m_64apsk[57] = gr_complex((r4 * cos(17 * GR_M_PI / 20.0)), (r4 * sin(17 * GR_M_PI / 20.0)));
+          m_64apsk[58] = gr_complex((r2 * cos(13 * GR_M_PI / 16.0)), (r2 * sin(13 * GR_M_PI / 16.0)));
+          m_64apsk[59] = gr_complex((r3 * cos(17 * GR_M_PI / 20.0)), (r3 * sin(17 * GR_M_PI / 20.0)));
+          m_64apsk[60] = gr_complex((r1 * cos(7 * GR_M_PI / 8.0)), (r1 * sin(7 * GR_M_PI / 8.0)));
+          m_64apsk[61] = gr_complex((r4 * cos(19 * GR_M_PI / 20.0)), (r4 * sin(19 * GR_M_PI / 20.0)));
+          m_64apsk[62] = gr_complex((r2 * cos(15 * GR_M_PI / 16.0)), (r2 * sin(15 * GR_M_PI / 16.0)));
+          m_64apsk[63] = gr_complex((r3 * cos(19 * GR_M_PI / 20.0)), (r3 * sin(19 * GR_M_PI / 20.0)));
           break;
         case MOD_4_12_20_28APSK:
           r4 = m;
@@ -620,70 +621,70 @@ namespace gr {
               r3 = 0;
               break;
           }
-          m_64apsk[0] = gr_complex((r4 * cos(M_PI / 4.0)), (r4 * sin(M_PI / 4.0)));
-          m_64apsk[1] = gr_complex((r4 * cos(7 * M_PI / 4.0)), (r4 * sin(7 * M_PI / 4.0)));
-          m_64apsk[2] = gr_complex((r4 * cos(3 * M_PI / 4.0)), (r4 * sin(3 * M_PI / 4.0)));
-          m_64apsk[3] = gr_complex((r4 * cos(5 * M_PI / 4.0)), (r4 * sin(5 * M_PI / 4.0)));
-          m_64apsk[4] = gr_complex((r4 * cos(13 * M_PI / 28.0)), (r4 * sin(13 * M_PI / 28.0)));
-          m_64apsk[5] = gr_complex((r4 * cos(43 * M_PI / 28.0)), (r4 * sin(43 * M_PI / 28.0)));
-          m_64apsk[6] = gr_complex((r4 * cos(15 * M_PI / 28.0)), (r4 * sin(15 * M_PI / 28.0)));
-          m_64apsk[7] = gr_complex((r4 * cos(41 * M_PI / 28.0)), (r4 * sin(41 * M_PI / 28.0)));
-          m_64apsk[8] = gr_complex((r4 * cos(M_PI / 28.0)), (r4 * sin(M_PI / 28.0)));
-          m_64apsk[9] = gr_complex((r4 * cos(55 * M_PI / 28.0)), (r4 * sin(55 * M_PI / 28.0)));
-          m_64apsk[10] = gr_complex((r4 * cos(27 * M_PI / 28.0)), (r4 * sin(27 * M_PI / 28.0)));
-          m_64apsk[11] = gr_complex((r4 * cos(29 * M_PI / 28.0)), (r4 * sin(29 * M_PI / 28.0)));
-          m_64apsk[12] = gr_complex((r1 * cos(M_PI / 4.0)), (r1 * sin(M_PI / 4.0)));
-          m_64apsk[13] = gr_complex((r1 * cos(7 * M_PI / 4.0)), (r1 * sin(7 * M_PI / 4.0)));
-          m_64apsk[14] = gr_complex((r1 * cos(3 * M_PI / 4.0)), (r1 * sin(3 * M_PI / 4.0)));
-          m_64apsk[15] = gr_complex((r1 * cos(5 * M_PI / 4.0)), (r1 * sin(5 * M_PI / 4.0)));
-          m_64apsk[16] = gr_complex((r4 * cos(9 * M_PI / 28.0)), (r4 * sin(9 * M_PI / 28.0)));
-          m_64apsk[17] = gr_complex((r4 * cos(47 * M_PI / 28.0)), (r4 * sin(47 * M_PI / 28.0)));
-          m_64apsk[18] = gr_complex((r4 * cos(19 * M_PI / 28.0)), (r4 * sin(19 * M_PI / 28.0)));
-          m_64apsk[19] = gr_complex((r4 * cos(37 * M_PI / 28.0)), (r4 * sin(37 * M_PI / 28.0)));
-          m_64apsk[20] = gr_complex((r4 * cos(11 * M_PI / 28.0)), (r4 * sin(11 * M_PI / 28.0)));
-          m_64apsk[21] = gr_complex((r4 * cos(45 * M_PI / 28.0)), (r4 * sin(45 * M_PI / 28.0)));
-          m_64apsk[22] = gr_complex((r4 * cos(17 * M_PI / 28.0)), (r4 * sin(17 * M_PI / 28.0)));
-          m_64apsk[23] = gr_complex((r4 * cos(39 * M_PI / 28.0)), (r4 * sin(39 * M_PI / 28.0)));
-          m_64apsk[24] = gr_complex((r3 * cos(M_PI / 20.0)), (r3 * sin(M_PI / 20.0)));
-          m_64apsk[25] = gr_complex((r3 * cos(39 * M_PI / 20.0)), (r3 * sin(39 * M_PI / 20.0)));
-          m_64apsk[26] = gr_complex((r3 * cos(19 * M_PI / 20.0)), (r3 * sin(19 * M_PI / 20.0)));
-          m_64apsk[27] = gr_complex((r3 * cos(21 * M_PI / 20.0)), (r3 * sin(21 * M_PI / 20.0)));
-          m_64apsk[28] = gr_complex((r2 * cos(M_PI / 12.0)), (r2 * sin(M_PI / 12.0)));
-          m_64apsk[29] = gr_complex((r2 * cos(23 * M_PI / 12.0)), (r2 * sin(23 * M_PI / 12.0)));
-          m_64apsk[30] = gr_complex((r2 * cos(11 * M_PI / 12.0)), (r2 * sin(11 * M_PI / 12.0)));
-          m_64apsk[31] = gr_complex((r2 * cos(13 * M_PI / 12.0)), (r2 * sin(13 * M_PI / 12.0)));
-          m_64apsk[32] = gr_complex((r4 * cos(5 * M_PI / 28.0)), (r4 * sin(5 * M_PI / 28.0)));
-          m_64apsk[33] = gr_complex((r4 * cos(51 * M_PI / 28.0)), (r4 * sin(51 * M_PI / 28.0)));
-          m_64apsk[34] = gr_complex((r4 * cos(23 * M_PI / 28.0)), (r4 * sin(23 * M_PI / 28.0)));
-          m_64apsk[35] = gr_complex((r4 * cos(33 * M_PI / 28.0)), (r4 * sin(33 * M_PI / 28.0)));
-          m_64apsk[36] = gr_complex((r3 * cos(9 * M_PI / 20.0)), (r3 * sin(9 * M_PI / 20.0)));
-          m_64apsk[37] = gr_complex((r3 * cos(31 * M_PI / 20.0)), (r3 * sin(31 * M_PI / 20.0)));
-          m_64apsk[38] = gr_complex((r3 * cos(11 * M_PI / 20.0)), (r3 * sin(11 * M_PI / 20.0)));
-          m_64apsk[39] = gr_complex((r3 * cos(29 * M_PI / 20.0)), (r3 * sin(29 * M_PI / 20.0)));
-          m_64apsk[40] = gr_complex((r4 * cos(3 * M_PI / 28.0)), (r4 * sin(3 * M_PI / 28.0)));
-          m_64apsk[41] = gr_complex((r4 * cos(53 * M_PI / 28.0)), (r4 * sin(53 * M_PI / 28.0)));
-          m_64apsk[42] = gr_complex((r4 * cos(25 * M_PI / 28.0)), (r4 * sin(25 * M_PI / 28.0)));
-          m_64apsk[43] = gr_complex((r4 * cos(31 * M_PI / 28.0)), (r4 * sin(31 * M_PI / 28.0)));
-          m_64apsk[44] = gr_complex((r2 * cos(5 * M_PI / 12.0)), (r2 * sin(5 * M_PI / 12.0)));
-          m_64apsk[45] = gr_complex((r2 * cos(19 * M_PI / 12.0)), (r2 * sin(19 * M_PI / 12.0)));
-          m_64apsk[46] = gr_complex((r2 * cos(7 * M_PI / 12.0)), (r2 * sin(7 * M_PI / 12.0)));
-          m_64apsk[47] = gr_complex((r2 * cos(17 * M_PI / 12.0)), (r2 * sin(17 * M_PI / 12.0)));
-          m_64apsk[48] = gr_complex((r3 * cos(M_PI / 4.0)), (r3 * sin(M_PI / 4.0)));
-          m_64apsk[49] = gr_complex((r3 * cos(7 * M_PI / 4.0)), (r3 * sin(7 * M_PI / 4.0)));
-          m_64apsk[50] = gr_complex((r3 * cos(3 * M_PI / 4.0)), (r3 * sin(3 * M_PI / 4.0)));
-          m_64apsk[51] = gr_complex((r3 * cos(5 * M_PI / 4.0)), (r3 * sin(5 * M_PI / 4.0)));
-          m_64apsk[52] = gr_complex((r3 * cos(7 * M_PI / 20.0)), (r3 * sin(7 * M_PI / 20.0)));
-          m_64apsk[53] = gr_complex((r3 * cos(33 * M_PI / 20.0)), (r3 * sin(33 * M_PI / 20.0)));
-          m_64apsk[54] = gr_complex((r3 * cos(13 * M_PI / 20.0)), (r3 * sin(13 * M_PI / 20.0)));
-          m_64apsk[55] = gr_complex((r3 * cos(27 * M_PI / 20.0)), (r3 * sin(27 * M_PI / 20.0)));
-          m_64apsk[56] = gr_complex((r3 * cos(3 * M_PI / 20.0)), (r3 * sin(3 * M_PI / 20.0)));
-          m_64apsk[57] = gr_complex((r3 * cos(37 * M_PI / 20.0)), (r3 * sin(37 * M_PI / 20.0)));
-          m_64apsk[58] = gr_complex((r3 * cos(17 * M_PI / 20.0)), (r3 * sin(17 * M_PI / 20.0)));
-          m_64apsk[59] = gr_complex((r3 * cos(23 * M_PI / 20.0)), (r3 * sin(23 * M_PI / 20.0)));
-          m_64apsk[60] = gr_complex((r2 * cos(M_PI / 4.0)), (r2 * sin(M_PI / 4.0)));
-          m_64apsk[61] = gr_complex((r2 * cos(7 * M_PI / 4.0)), (r2 * sin(7 * M_PI / 4.0)));
-          m_64apsk[62] = gr_complex((r2 * cos(3 * M_PI / 4.0)), (r2 * sin(3 * M_PI / 4.0)));
-          m_64apsk[63] = gr_complex((r2 * cos(5 * M_PI / 4.0)), (r2 * sin(5 * M_PI / 4.0)));
+          m_64apsk[0] = gr_complex((r4 * cos(GR_M_PI / 4.0)), (r4 * sin(GR_M_PI / 4.0)));
+          m_64apsk[1] = gr_complex((r4 * cos(7 * GR_M_PI / 4.0)), (r4 * sin(7 * GR_M_PI / 4.0)));
+          m_64apsk[2] = gr_complex((r4 * cos(3 * GR_M_PI / 4.0)), (r4 * sin(3 * GR_M_PI / 4.0)));
+          m_64apsk[3] = gr_complex((r4 * cos(5 * GR_M_PI / 4.0)), (r4 * sin(5 * GR_M_PI / 4.0)));
+          m_64apsk[4] = gr_complex((r4 * cos(13 * GR_M_PI / 28.0)), (r4 * sin(13 * GR_M_PI / 28.0)));
+          m_64apsk[5] = gr_complex((r4 * cos(43 * GR_M_PI / 28.0)), (r4 * sin(43 * GR_M_PI / 28.0)));
+          m_64apsk[6] = gr_complex((r4 * cos(15 * GR_M_PI / 28.0)), (r4 * sin(15 * GR_M_PI / 28.0)));
+          m_64apsk[7] = gr_complex((r4 * cos(41 * GR_M_PI / 28.0)), (r4 * sin(41 * GR_M_PI / 28.0)));
+          m_64apsk[8] = gr_complex((r4 * cos(GR_M_PI / 28.0)), (r4 * sin(GR_M_PI / 28.0)));
+          m_64apsk[9] = gr_complex((r4 * cos(55 * GR_M_PI / 28.0)), (r4 * sin(55 * GR_M_PI / 28.0)));
+          m_64apsk[10] = gr_complex((r4 * cos(27 * GR_M_PI / 28.0)), (r4 * sin(27 * GR_M_PI / 28.0)));
+          m_64apsk[11] = gr_complex((r4 * cos(29 * GR_M_PI / 28.0)), (r4 * sin(29 * GR_M_PI / 28.0)));
+          m_64apsk[12] = gr_complex((r1 * cos(GR_M_PI / 4.0)), (r1 * sin(GR_M_PI / 4.0)));
+          m_64apsk[13] = gr_complex((r1 * cos(7 * GR_M_PI / 4.0)), (r1 * sin(7 * GR_M_PI / 4.0)));
+          m_64apsk[14] = gr_complex((r1 * cos(3 * GR_M_PI / 4.0)), (r1 * sin(3 * GR_M_PI / 4.0)));
+          m_64apsk[15] = gr_complex((r1 * cos(5 * GR_M_PI / 4.0)), (r1 * sin(5 * GR_M_PI / 4.0)));
+          m_64apsk[16] = gr_complex((r4 * cos(9 * GR_M_PI / 28.0)), (r4 * sin(9 * GR_M_PI / 28.0)));
+          m_64apsk[17] = gr_complex((r4 * cos(47 * GR_M_PI / 28.0)), (r4 * sin(47 * GR_M_PI / 28.0)));
+          m_64apsk[18] = gr_complex((r4 * cos(19 * GR_M_PI / 28.0)), (r4 * sin(19 * GR_M_PI / 28.0)));
+          m_64apsk[19] = gr_complex((r4 * cos(37 * GR_M_PI / 28.0)), (r4 * sin(37 * GR_M_PI / 28.0)));
+          m_64apsk[20] = gr_complex((r4 * cos(11 * GR_M_PI / 28.0)), (r4 * sin(11 * GR_M_PI / 28.0)));
+          m_64apsk[21] = gr_complex((r4 * cos(45 * GR_M_PI / 28.0)), (r4 * sin(45 * GR_M_PI / 28.0)));
+          m_64apsk[22] = gr_complex((r4 * cos(17 * GR_M_PI / 28.0)), (r4 * sin(17 * GR_M_PI / 28.0)));
+          m_64apsk[23] = gr_complex((r4 * cos(39 * GR_M_PI / 28.0)), (r4 * sin(39 * GR_M_PI / 28.0)));
+          m_64apsk[24] = gr_complex((r3 * cos(GR_M_PI / 20.0)), (r3 * sin(GR_M_PI / 20.0)));
+          m_64apsk[25] = gr_complex((r3 * cos(39 * GR_M_PI / 20.0)), (r3 * sin(39 * GR_M_PI / 20.0)));
+          m_64apsk[26] = gr_complex((r3 * cos(19 * GR_M_PI / 20.0)), (r3 * sin(19 * GR_M_PI / 20.0)));
+          m_64apsk[27] = gr_complex((r3 * cos(21 * GR_M_PI / 20.0)), (r3 * sin(21 * GR_M_PI / 20.0)));
+          m_64apsk[28] = gr_complex((r2 * cos(GR_M_PI / 12.0)), (r2 * sin(GR_M_PI / 12.0)));
+          m_64apsk[29] = gr_complex((r2 * cos(23 * GR_M_PI / 12.0)), (r2 * sin(23 * GR_M_PI / 12.0)));
+          m_64apsk[30] = gr_complex((r2 * cos(11 * GR_M_PI / 12.0)), (r2 * sin(11 * GR_M_PI / 12.0)));
+          m_64apsk[31] = gr_complex((r2 * cos(13 * GR_M_PI / 12.0)), (r2 * sin(13 * GR_M_PI / 12.0)));
+          m_64apsk[32] = gr_complex((r4 * cos(5 * GR_M_PI / 28.0)), (r4 * sin(5 * GR_M_PI / 28.0)));
+          m_64apsk[33] = gr_complex((r4 * cos(51 * GR_M_PI / 28.0)), (r4 * sin(51 * GR_M_PI / 28.0)));
+          m_64apsk[34] = gr_complex((r4 * cos(23 * GR_M_PI / 28.0)), (r4 * sin(23 * GR_M_PI / 28.0)));
+          m_64apsk[35] = gr_complex((r4 * cos(33 * GR_M_PI / 28.0)), (r4 * sin(33 * GR_M_PI / 28.0)));
+          m_64apsk[36] = gr_complex((r3 * cos(9 * GR_M_PI / 20.0)), (r3 * sin(9 * GR_M_PI / 20.0)));
+          m_64apsk[37] = gr_complex((r3 * cos(31 * GR_M_PI / 20.0)), (r3 * sin(31 * GR_M_PI / 20.0)));
+          m_64apsk[38] = gr_complex((r3 * cos(11 * GR_M_PI / 20.0)), (r3 * sin(11 * GR_M_PI / 20.0)));
+          m_64apsk[39] = gr_complex((r3 * cos(29 * GR_M_PI / 20.0)), (r3 * sin(29 * GR_M_PI / 20.0)));
+          m_64apsk[40] = gr_complex((r4 * cos(3 * GR_M_PI / 28.0)), (r4 * sin(3 * GR_M_PI / 28.0)));
+          m_64apsk[41] = gr_complex((r4 * cos(53 * GR_M_PI / 28.0)), (r4 * sin(53 * GR_M_PI / 28.0)));
+          m_64apsk[42] = gr_complex((r4 * cos(25 * GR_M_PI / 28.0)), (r4 * sin(25 * GR_M_PI / 28.0)));
+          m_64apsk[43] = gr_complex((r4 * cos(31 * GR_M_PI / 28.0)), (r4 * sin(31 * GR_M_PI / 28.0)));
+          m_64apsk[44] = gr_complex((r2 * cos(5 * GR_M_PI / 12.0)), (r2 * sin(5 * GR_M_PI / 12.0)));
+          m_64apsk[45] = gr_complex((r2 * cos(19 * GR_M_PI / 12.0)), (r2 * sin(19 * GR_M_PI / 12.0)));
+          m_64apsk[46] = gr_complex((r2 * cos(7 * GR_M_PI / 12.0)), (r2 * sin(7 * GR_M_PI / 12.0)));
+          m_64apsk[47] = gr_complex((r2 * cos(17 * GR_M_PI / 12.0)), (r2 * sin(17 * GR_M_PI / 12.0)));
+          m_64apsk[48] = gr_complex((r3 * cos(GR_M_PI / 4.0)), (r3 * sin(GR_M_PI / 4.0)));
+          m_64apsk[49] = gr_complex((r3 * cos(7 * GR_M_PI / 4.0)), (r3 * sin(7 * GR_M_PI / 4.0)));
+          m_64apsk[50] = gr_complex((r3 * cos(3 * GR_M_PI / 4.0)), (r3 * sin(3 * GR_M_PI / 4.0)));
+          m_64apsk[51] = gr_complex((r3 * cos(5 * GR_M_PI / 4.0)), (r3 * sin(5 * GR_M_PI / 4.0)));
+          m_64apsk[52] = gr_complex((r3 * cos(7 * GR_M_PI / 20.0)), (r3 * sin(7 * GR_M_PI / 20.0)));
+          m_64apsk[53] = gr_complex((r3 * cos(33 * GR_M_PI / 20.0)), (r3 * sin(33 * GR_M_PI / 20.0)));
+          m_64apsk[54] = gr_complex((r3 * cos(13 * GR_M_PI / 20.0)), (r3 * sin(13 * GR_M_PI / 20.0)));
+          m_64apsk[55] = gr_complex((r3 * cos(27 * GR_M_PI / 20.0)), (r3 * sin(27 * GR_M_PI / 20.0)));
+          m_64apsk[56] = gr_complex((r3 * cos(3 * GR_M_PI / 20.0)), (r3 * sin(3 * GR_M_PI / 20.0)));
+          m_64apsk[57] = gr_complex((r3 * cos(37 * GR_M_PI / 20.0)), (r3 * sin(37 * GR_M_PI / 20.0)));
+          m_64apsk[58] = gr_complex((r3 * cos(17 * GR_M_PI / 20.0)), (r3 * sin(17 * GR_M_PI / 20.0)));
+          m_64apsk[59] = gr_complex((r3 * cos(23 * GR_M_PI / 20.0)), (r3 * sin(23 * GR_M_PI / 20.0)));
+          m_64apsk[60] = gr_complex((r2 * cos(GR_M_PI / 4.0)), (r2 * sin(GR_M_PI / 4.0)));
+          m_64apsk[61] = gr_complex((r2 * cos(7 * GR_M_PI / 4.0)), (r2 * sin(7 * GR_M_PI / 4.0)));
+          m_64apsk[62] = gr_complex((r2 * cos(3 * GR_M_PI / 4.0)), (r2 * sin(3 * GR_M_PI / 4.0)));
+          m_64apsk[63] = gr_complex((r2 * cos(5 * GR_M_PI / 4.0)), (r2 * sin(5 * GR_M_PI / 4.0)));
           break;
         case MOD_128APSK:
           r6 = m;
@@ -710,134 +711,134 @@ namespace gr {
               r5 = 0;
               break;
           }
-          m_128apsk[0] = gr_complex((r1 * cos(83 * M_PI / 1260.0)), (r1 * sin(83 * M_PI / 1260.0)));
-          m_128apsk[1] = gr_complex((r6 * cos(11 * M_PI / 105.0)), (r6 * sin(11 * M_PI / 105.0)));
-          m_128apsk[2] = gr_complex((r6 * cos(37 * M_PI / 1680.0)), (r6 * sin(37 * M_PI / 1680.0)));
-          m_128apsk[3] = gr_complex((r6 * cos(11 * M_PI / 168.0)), (r6 * sin(11 * M_PI / 168.0)));
-          m_128apsk[4] = gr_complex((r2 * cos(121 * M_PI / 2520.0)), (r2 * sin(121 * M_PI / 2520.0)));
-          m_128apsk[5] = gr_complex((r3 * cos(23 * M_PI / 280.0)), (r3 * sin(23 * M_PI / 280.0)));
-          m_128apsk[6] = gr_complex((r5 * cos(19 * M_PI / 720.0)), (r5 * sin(19 * M_PI / 720.0)));
-          m_128apsk[7] = gr_complex((r4 * cos(61 * M_PI / 720.0)), (r4 * sin(61 * M_PI / 720.0)));
-          m_128apsk[8] = gr_complex((r1 * cos(103 * M_PI / 560.0)), (r1 * sin(103 * M_PI / 560.0)));
-          m_128apsk[9] = gr_complex((r6 * cos(61 * M_PI / 420.0)), (r6 * sin(61 * M_PI / 420.0)));
-          m_128apsk[10] = gr_complex((r6 * cos(383 * M_PI / 1680.0)), (r6 * sin(383 * M_PI / 1680.0)));
-          m_128apsk[11] = gr_complex((r6 * cos(929 * M_PI / 5040.0)), (r6 * sin(929 * M_PI / 5040.0)));
-          m_128apsk[12] = gr_complex((r2 * cos(113 * M_PI / 560.0)), (r2 * sin(113 * M_PI / 560.0)));
-          m_128apsk[13] = gr_complex((r3 * cos(169 * M_PI / 1008.0)), (r3 * sin(169 * M_PI / 1008.0)));
-          m_128apsk[14] = gr_complex((r5 * cos(563 * M_PI / 2520.0)), (r5 * sin(563 * M_PI / 2520.0)));
-          m_128apsk[15] = gr_complex((r4 * cos(139 * M_PI / 840.0)), (r4 * sin(139 * M_PI / 840.0)));
-          m_128apsk[16] = gr_complex((r1 * cos(243 * M_PI / 560.0)), (r1 * sin(243 * M_PI / 560.0)));
-          m_128apsk[17] = gr_complex((r6 * cos(1993 * M_PI / 5040.0)), (r6 * sin(1993 * M_PI / 5040.0)));
-          m_128apsk[18] = gr_complex((r6 * cos(43 * M_PI / 90.0)), (r6 * sin(43 * M_PI / 90.0)));
-          m_128apsk[19] = gr_complex((r6 * cos(73 * M_PI / 168.0)), (r6 * sin(73 * M_PI / 168.0)));
-          m_128apsk[20] = gr_complex((r2 * cos(1139 * M_PI / 2520.0)), (r2 * sin(1139 * M_PI / 2520.0)));
-          m_128apsk[21] = gr_complex((r3 * cos(117 * M_PI / 280.0)), (r3 * sin(117 * M_PI / 280.0)));
-          m_128apsk[22] = gr_complex((r5 * cos(341 * M_PI / 720.0)), (r5 * sin(341 * M_PI / 720.0)));
-          m_128apsk[23] = gr_complex((r4 * cos(349 * M_PI / 840.0)), (r4 * sin(349 * M_PI / 840.0)));
-          m_128apsk[24] = gr_complex((r1 * cos(177 * M_PI / 560.0)), (r1 * sin(177 * M_PI / 560.0)));
-          m_128apsk[25] = gr_complex((r6 * cos(1789 * M_PI / 5040.0)), (r6 * sin(1789 * M_PI / 5040.0)));
-          m_128apsk[26] = gr_complex((r6 * cos(49 * M_PI / 180.0)), (r6 * sin(49 * M_PI / 180.0)));
-          m_128apsk[27] = gr_complex((r6 * cos(53 * M_PI / 168.0)), (r6 * sin(53 * M_PI / 168.0)));
-          m_128apsk[28] = gr_complex((r2 * cos(167 * M_PI / 560.0)), (r2 * sin(167 * M_PI / 560.0)));
-          m_128apsk[29] = gr_complex((r3 * cos(239 * M_PI / 720.0)), (r3 * sin(239 * M_PI / 720.0)));
-          m_128apsk[30] = gr_complex((r5 * cos(199 * M_PI / 720.0)), (r5 * sin(199 * M_PI / 720.0)));
-          m_128apsk[31] = gr_complex((r4 * cos(281 * M_PI / 840.0)), (r4 * sin(281 * M_PI / 840.0)));
-          m_128apsk[32] = gr_complex((r1 * cos(1177 * M_PI / 1260.0)), (r1 * sin(1177 * M_PI / 1260.0)));
-          m_128apsk[33] = gr_complex((r6 * cos(94 * M_PI / 105.0)), (r6 * sin(94 * M_PI / 105.0)));
-          m_128apsk[34] = gr_complex((r6 * cos(1643 * M_PI / 1680.0)), (r6 * sin(1643 * M_PI / 1680.0)));
-          m_128apsk[35] = gr_complex((r6 * cos(157 * M_PI / 168.0)), (r6 * sin(157 * M_PI / 168.0)));
-          m_128apsk[36] = gr_complex((r2 * cos(2399 * M_PI / 2520.0)), (r2 * sin(2399 * M_PI / 2520.0)));
-          m_128apsk[37] = gr_complex((r3 * cos(257 * M_PI / 280.0)), (r3 * sin(257 * M_PI / 280.0)));
-          m_128apsk[38] = gr_complex((r5 * cos(701 * M_PI / 720.0)), (r5 * sin(701 * M_PI / 720.0)));
-          m_128apsk[39] = gr_complex((r4 * cos(659 * M_PI / 720.0)), (r4 * sin(659 * M_PI / 720.0)));
-          m_128apsk[40] = gr_complex((r1 * cos(457 * M_PI / 560.0)), (r1 * sin(457 * M_PI / 560.0)));
-          m_128apsk[41] = gr_complex((r6 * cos(359 * M_PI / 420.0)), (r6 * sin(359 * M_PI / 420.0)));
-          m_128apsk[42] = gr_complex((r6 * cos(1297 * M_PI / 1680.0)), (r6 * sin(1297 * M_PI / 1680.0)));
-          m_128apsk[43] = gr_complex((r6 * cos(4111 * M_PI / 5040.0)), (r6 * sin(4111 * M_PI / 5040.0)));
-          m_128apsk[44] = gr_complex((r2 * cos(447 * M_PI / 560.0)), (r2 * sin(447 * M_PI / 560.0)));
-          m_128apsk[45] = gr_complex((r3 * cos(839 * M_PI / 1008.0)), (r3 * sin(839 * M_PI / 1008.0)));
-          m_128apsk[46] = gr_complex((r5 * cos(1957 * M_PI / 2520.0)), (r5 * sin(1957 * M_PI / 2520.0)));
-          m_128apsk[47] = gr_complex((r4 * cos(701 * M_PI / 840.0)), (r4 * sin(701 * M_PI / 840.0)));
-          m_128apsk[48] = gr_complex((r1 * cos(317 * M_PI / 560.0)), (r1 * sin(317 * M_PI / 560.0)));
-          m_128apsk[49] = gr_complex((r6 * cos(3047 * M_PI / 5040.0)), (r6 * sin(3047 * M_PI / 5040.0)));
-          m_128apsk[50] = gr_complex((r6 * cos(47 * M_PI / 90.0)), (r6 * sin(47 * M_PI / 90.0)));
-          m_128apsk[51] = gr_complex((r6 * cos(95 * M_PI / 168.0)), (r6 * sin(95 * M_PI / 168.0)));
-          m_128apsk[52] = gr_complex((r2 * cos(1381 * M_PI / 2520.0)), (r2 * sin(1381 * M_PI / 2520.0)));
-          m_128apsk[53] = gr_complex((r3 * cos(163 * M_PI / 280.0)), (r3 * sin(163 * M_PI / 280.0)));
-          m_128apsk[54] = gr_complex((r5 * cos(379 * M_PI / 720.0)), (r5 * sin(379 * M_PI / 720.0)));
-          m_128apsk[55] = gr_complex((r4 * cos(491 * M_PI / 840.0)), (r4 * sin(491 * M_PI / 840.0)));
-          m_128apsk[56] = gr_complex((r1 * cos(383 * M_PI / 560.0)), (r1 * sin(383 * M_PI / 560.0)));
-          m_128apsk[57] = gr_complex((r6 * cos(3251 * M_PI / 5040.0)), (r6 * sin(3251 * M_PI / 5040.0)));
-          m_128apsk[58] = gr_complex((r6 * cos(131 * M_PI / 180.0)), (r6 * sin(131 * M_PI / 180.0)));
-          m_128apsk[59] = gr_complex((r6 * cos(115 * M_PI / 168.0)), (r6 * sin(115 * M_PI / 168.0)));
-          m_128apsk[60] = gr_complex((r2 * cos(393 * M_PI / 560.0)), (r2 * sin(393 * M_PI / 560.0)));
-          m_128apsk[61] = gr_complex((r3 * cos(481 * M_PI / 720.0)), (r3 * sin(481 * M_PI / 720.0)));
-          m_128apsk[62] = gr_complex((r5 * cos(521 * M_PI / 720.0)), (r5 * sin(521 * M_PI / 720.0)));
-          m_128apsk[63] = gr_complex((r4 * cos(559 * M_PI / 840.0)), (r4 * sin(559 * M_PI / 840.0)));
-          m_128apsk[64] = gr_complex((r1 * cos(2437 * M_PI / 1260.0)), (r1 * sin(2437 * M_PI / 1260.0)));
-          m_128apsk[65] = gr_complex((r6 * cos(199 * M_PI / 105.0)), (r6 * sin(199 * M_PI / 105.0)));
-          m_128apsk[66] = gr_complex((r6 * cos(3323 * M_PI / 1680.0)), (r6 * sin(3323 * M_PI / 1680.0)));
-          m_128apsk[67] = gr_complex((r6 * cos(325 * M_PI / 168.0)), (r6 * sin(325 * M_PI / 168.0)));
-          m_128apsk[68] = gr_complex((r2 * cos(4919 * M_PI / 2520.0)), (r2 * sin(4919 * M_PI / 2520.0)));
-          m_128apsk[69] = gr_complex((r3 * cos(537 * M_PI / 280.0)), (r3 * sin(537 * M_PI / 280.0)));
-          m_128apsk[70] = gr_complex((r5 * cos(1421 * M_PI / 720.0)), (r5 * sin(1421 * M_PI / 720.0)));
-          m_128apsk[71] = gr_complex((r4 * cos(1379 * M_PI / 720.0)), (r4 * sin(1379 * M_PI / 720.0)));
-          m_128apsk[72] = gr_complex((r1 * cos(1017 * M_PI / 560.0)), (r1 * sin(1017 * M_PI / 560.0)));
-          m_128apsk[73] = gr_complex((r6 * cos(779 * M_PI / 420.0)), (r6 * sin(779 * M_PI / 420.0)));
-          m_128apsk[74] = gr_complex((r6 * cos(2977 * M_PI / 1680.0)), (r6 * sin(2977 * M_PI / 1680.0)));
-          m_128apsk[75] = gr_complex((r6 * cos(9151 * M_PI / 5040.0)), (r6 * sin(9151 * M_PI / 5040.0)));
-          m_128apsk[76] = gr_complex((r2 * cos(1007 * M_PI / 560.0)), (r2 * sin(1007 * M_PI / 560.0)));
-          m_128apsk[77] = gr_complex((r3 * cos(1847 * M_PI / 1008.0)), (r3 * sin(1847 * M_PI / 1008.0)));
-          m_128apsk[78] = gr_complex((r5 * cos(4477 * M_PI / 2520.0)), (r5 * sin(4477 * M_PI / 2520.0)));
-          m_128apsk[79] = gr_complex((r4 * cos(1541 * M_PI / 840.0)), (r4 * sin(1541 * M_PI / 840.0)));
-          m_128apsk[80] = gr_complex((r1 * cos(877 * M_PI / 560.0)), (r1 * sin(877 * M_PI / 560.0)));
-          m_128apsk[81] = gr_complex((r6 * cos(8087 * M_PI / 5040.0)), (r6 * sin(8087 * M_PI / 5040.0)));
-          m_128apsk[82] = gr_complex((r6 * cos(137 * M_PI / 90.0)), (r6 * sin(137 * M_PI / 90.0)));
-          m_128apsk[83] = gr_complex((r6 * cos(263 * M_PI / 168.0)), (r6 * sin(263 * M_PI / 168.0)));
-          m_128apsk[84] = gr_complex((r2 * cos(3901 * M_PI / 2520.0)), (r2 * sin(3901 * M_PI / 2520.0)));
-          m_128apsk[85] = gr_complex((r3 * cos(443 * M_PI / 280.0)), (r3 * sin(443 * M_PI / 280.0)));
-          m_128apsk[86] = gr_complex((r5 * cos(1099 * M_PI / 720.0)), (r5 * sin(1099 * M_PI / 720.0)));
-          m_128apsk[87] = gr_complex((r4 * cos(1331 * M_PI / 840.0)), (r4 * sin(1331 * M_PI / 840.0)));
-          m_128apsk[88] = gr_complex((r1 * cos(943 * M_PI / 560.0)), (r1 * sin(943 * M_PI / 560.0)));
-          m_128apsk[89] = gr_complex((r6 * cos(8291 * M_PI / 5040.0)), (r6 * sin(8291 * M_PI / 5040.0)));
-          m_128apsk[90] = gr_complex((r6 * cos(311 * M_PI / 180.0)), (r6 * sin(311 * M_PI / 180.0)));
-          m_128apsk[91] = gr_complex((r6 * cos(283 * M_PI / 168.0)), (r6 * sin(283 * M_PI / 168.0)));
-          m_128apsk[92] = gr_complex((r2 * cos(953 * M_PI / 560.0)), (r2 * sin(953 * M_PI / 560.0)));
-          m_128apsk[93] = gr_complex((r3 * cos(1201 * M_PI / 720.0)), (r3 * sin(1201 * M_PI / 720.0)));
-          m_128apsk[94] = gr_complex((r5 * cos(1241 * M_PI / 720.0)), (r5 * sin(1241 * M_PI / 720.0)));
-          m_128apsk[95] = gr_complex((r4 * cos(1399 * M_PI / 840.0)), (r4 * sin(1399 * M_PI / 840.0)));
-          m_128apsk[96] = gr_complex((r1 * cos(1343 * M_PI / 1260.0)), (r1 * sin(1343 * M_PI / 1260.0)));
-          m_128apsk[97] = gr_complex((r6 * cos(116 * M_PI / 105.0)), (r6 * sin(116 * M_PI / 105.0)));
-          m_128apsk[98] = gr_complex((r6 * cos(1717 * M_PI / 1680.0)), (r6 * sin(1717 * M_PI / 1680.0)));
-          m_128apsk[99] = gr_complex((r6 * cos(179 * M_PI / 168.0)), (r6 * sin(179 * M_PI / 168.0)));
-          m_128apsk[100] = gr_complex((r2 * cos(2641 * M_PI / 2520.0)), (r2 * sin(2641 * M_PI / 2520.0)));
-          m_128apsk[101] = gr_complex((r3 * cos(303 * M_PI / 280.0)), (r3 * sin(303 * M_PI / 280.0)));
-          m_128apsk[102] = gr_complex((r5 * cos(739 * M_PI / 720.0)), (r5 * sin(739 * M_PI / 720.0)));
-          m_128apsk[103] = gr_complex((r4 * cos(781 * M_PI / 720.0)), (r4 * sin(781 * M_PI / 720.0)));
-          m_128apsk[104] = gr_complex((r1 * cos(663 * M_PI / 560.0)), (r1 * sin(663 * M_PI / 560.0)));
-          m_128apsk[105] = gr_complex((r6 * cos(481 * M_PI / 420.0)), (r6 * sin(481 * M_PI / 420.0)));
-          m_128apsk[106] = gr_complex((r6 * cos(2063 * M_PI / 1680.0)), (r6 * sin(2063 * M_PI / 1680.0)));
-          m_128apsk[107] = gr_complex((r6 * cos(5969 * M_PI / 5040.0)), (r6 * sin(5969 * M_PI / 5040.0)));
-          m_128apsk[108] = gr_complex((r2 * cos(673 * M_PI / 560.0)), (r2 * sin(673 * M_PI / 560.0)));
-          m_128apsk[109] = gr_complex((r3 * cos(1177 * M_PI / 1008.0)), (r3 * sin(1177 * M_PI / 1008.0)));
-          m_128apsk[110] = gr_complex((r5 * cos(3083 * M_PI / 2520.0)), (r5 * sin(3083 * M_PI / 2520.0)));
-          m_128apsk[111] = gr_complex((r4 * cos(979 * M_PI / 840.0)), (r4 * sin(979 * M_PI / 840.0)));
-          m_128apsk[112] = gr_complex((r1 * cos(803 * M_PI / 560.0)), (r1 * sin(803 * M_PI / 560.0)));
-          m_128apsk[113] = gr_complex((r6 * cos(7033 * M_PI / 5040.0)), (r6 * sin(7033 * M_PI / 5040.0)));
-          m_128apsk[114] = gr_complex((r6 * cos(133 * M_PI / 90.0)), (r6 * sin(133 * M_PI / 90.0)));
-          m_128apsk[115] = gr_complex((r6 * cos(241 * M_PI / 168.0)), (r6 * sin(241 * M_PI / 168.0)));
-          m_128apsk[116] = gr_complex((r2 * cos(3659 * M_PI / 2520.0)), (r2 * sin(3659 * M_PI / 2520.0)));
-          m_128apsk[117] = gr_complex((r3 * cos(397 * M_PI / 280.0)), (r3 * sin(397 * M_PI / 280.0)));
-          m_128apsk[118] = gr_complex((r5 * cos(1061 * M_PI / 720.0)), (r5 * sin(1061 * M_PI / 720.0)));
-          m_128apsk[119] = gr_complex((r4 * cos(1189 * M_PI / 840.0)), (r4 * sin(1189 * M_PI / 840.0)));
-          m_128apsk[120] = gr_complex((r1 * cos(737 * M_PI / 560.0)), (r1 * sin(737 * M_PI / 560.0)));
-          m_128apsk[121] = gr_complex((r6 * cos(6829 * M_PI / 5040.0)), (r6 * sin(6829 * M_PI / 5040.0)));
-          m_128apsk[122] = gr_complex((r6 * cos(229 * M_PI / 180.0)), (r6 * sin(229 * M_PI / 180.0)));
-          m_128apsk[123] = gr_complex((r6 * cos(221 * M_PI / 168.0)), (r6 * sin(221 * M_PI / 168.0)));
-          m_128apsk[124] = gr_complex((r2 * cos(727 * M_PI / 560.0)), (r2 * sin(727 * M_PI / 560.0)));
-          m_128apsk[125] = gr_complex((r3 * cos(959 * M_PI / 720.0)), (r3 * sin(959 * M_PI / 720.0)));
-          m_128apsk[126] = gr_complex((r5 * cos(919 * M_PI / 720.0)), (r5 * sin(919 * M_PI / 720.0)));
-          m_128apsk[127] = gr_complex((r4 * cos(1121 * M_PI / 840.0)), (r4 * sin(1121 * M_PI / 840.0)));
+          m_128apsk[0] = gr_complex((r1 * cos(83 * GR_M_PI / 1260.0)), (r1 * sin(83 * GR_M_PI / 1260.0)));
+          m_128apsk[1] = gr_complex((r6 * cos(11 * GR_M_PI / 105.0)), (r6 * sin(11 * GR_M_PI / 105.0)));
+          m_128apsk[2] = gr_complex((r6 * cos(37 * GR_M_PI / 1680.0)), (r6 * sin(37 * GR_M_PI / 1680.0)));
+          m_128apsk[3] = gr_complex((r6 * cos(11 * GR_M_PI / 168.0)), (r6 * sin(11 * GR_M_PI / 168.0)));
+          m_128apsk[4] = gr_complex((r2 * cos(121 * GR_M_PI / 2520.0)), (r2 * sin(121 * GR_M_PI / 2520.0)));
+          m_128apsk[5] = gr_complex((r3 * cos(23 * GR_M_PI / 280.0)), (r3 * sin(23 * GR_M_PI / 280.0)));
+          m_128apsk[6] = gr_complex((r5 * cos(19 * GR_M_PI / 720.0)), (r5 * sin(19 * GR_M_PI / 720.0)));
+          m_128apsk[7] = gr_complex((r4 * cos(61 * GR_M_PI / 720.0)), (r4 * sin(61 * GR_M_PI / 720.0)));
+          m_128apsk[8] = gr_complex((r1 * cos(103 * GR_M_PI / 560.0)), (r1 * sin(103 * GR_M_PI / 560.0)));
+          m_128apsk[9] = gr_complex((r6 * cos(61 * GR_M_PI / 420.0)), (r6 * sin(61 * GR_M_PI / 420.0)));
+          m_128apsk[10] = gr_complex((r6 * cos(383 * GR_M_PI / 1680.0)), (r6 * sin(383 * GR_M_PI / 1680.0)));
+          m_128apsk[11] = gr_complex((r6 * cos(929 * GR_M_PI / 5040.0)), (r6 * sin(929 * GR_M_PI / 5040.0)));
+          m_128apsk[12] = gr_complex((r2 * cos(113 * GR_M_PI / 560.0)), (r2 * sin(113 * GR_M_PI / 560.0)));
+          m_128apsk[13] = gr_complex((r3 * cos(169 * GR_M_PI / 1008.0)), (r3 * sin(169 * GR_M_PI / 1008.0)));
+          m_128apsk[14] = gr_complex((r5 * cos(563 * GR_M_PI / 2520.0)), (r5 * sin(563 * GR_M_PI / 2520.0)));
+          m_128apsk[15] = gr_complex((r4 * cos(139 * GR_M_PI / 840.0)), (r4 * sin(139 * GR_M_PI / 840.0)));
+          m_128apsk[16] = gr_complex((r1 * cos(243 * GR_M_PI / 560.0)), (r1 * sin(243 * GR_M_PI / 560.0)));
+          m_128apsk[17] = gr_complex((r6 * cos(1993 * GR_M_PI / 5040.0)), (r6 * sin(1993 * GR_M_PI / 5040.0)));
+          m_128apsk[18] = gr_complex((r6 * cos(43 * GR_M_PI / 90.0)), (r6 * sin(43 * GR_M_PI / 90.0)));
+          m_128apsk[19] = gr_complex((r6 * cos(73 * GR_M_PI / 168.0)), (r6 * sin(73 * GR_M_PI / 168.0)));
+          m_128apsk[20] = gr_complex((r2 * cos(1139 * GR_M_PI / 2520.0)), (r2 * sin(1139 * GR_M_PI / 2520.0)));
+          m_128apsk[21] = gr_complex((r3 * cos(117 * GR_M_PI / 280.0)), (r3 * sin(117 * GR_M_PI / 280.0)));
+          m_128apsk[22] = gr_complex((r5 * cos(341 * GR_M_PI / 720.0)), (r5 * sin(341 * GR_M_PI / 720.0)));
+          m_128apsk[23] = gr_complex((r4 * cos(349 * GR_M_PI / 840.0)), (r4 * sin(349 * GR_M_PI / 840.0)));
+          m_128apsk[24] = gr_complex((r1 * cos(177 * GR_M_PI / 560.0)), (r1 * sin(177 * GR_M_PI / 560.0)));
+          m_128apsk[25] = gr_complex((r6 * cos(1789 * GR_M_PI / 5040.0)), (r6 * sin(1789 * GR_M_PI / 5040.0)));
+          m_128apsk[26] = gr_complex((r6 * cos(49 * GR_M_PI / 180.0)), (r6 * sin(49 * GR_M_PI / 180.0)));
+          m_128apsk[27] = gr_complex((r6 * cos(53 * GR_M_PI / 168.0)), (r6 * sin(53 * GR_M_PI / 168.0)));
+          m_128apsk[28] = gr_complex((r2 * cos(167 * GR_M_PI / 560.0)), (r2 * sin(167 * GR_M_PI / 560.0)));
+          m_128apsk[29] = gr_complex((r3 * cos(239 * GR_M_PI / 720.0)), (r3 * sin(239 * GR_M_PI / 720.0)));
+          m_128apsk[30] = gr_complex((r5 * cos(199 * GR_M_PI / 720.0)), (r5 * sin(199 * GR_M_PI / 720.0)));
+          m_128apsk[31] = gr_complex((r4 * cos(281 * GR_M_PI / 840.0)), (r4 * sin(281 * GR_M_PI / 840.0)));
+          m_128apsk[32] = gr_complex((r1 * cos(1177 * GR_M_PI / 1260.0)), (r1 * sin(1177 * GR_M_PI / 1260.0)));
+          m_128apsk[33] = gr_complex((r6 * cos(94 * GR_M_PI / 105.0)), (r6 * sin(94 * GR_M_PI / 105.0)));
+          m_128apsk[34] = gr_complex((r6 * cos(1643 * GR_M_PI / 1680.0)), (r6 * sin(1643 * GR_M_PI / 1680.0)));
+          m_128apsk[35] = gr_complex((r6 * cos(157 * GR_M_PI / 168.0)), (r6 * sin(157 * GR_M_PI / 168.0)));
+          m_128apsk[36] = gr_complex((r2 * cos(2399 * GR_M_PI / 2520.0)), (r2 * sin(2399 * GR_M_PI / 2520.0)));
+          m_128apsk[37] = gr_complex((r3 * cos(257 * GR_M_PI / 280.0)), (r3 * sin(257 * GR_M_PI / 280.0)));
+          m_128apsk[38] = gr_complex((r5 * cos(701 * GR_M_PI / 720.0)), (r5 * sin(701 * GR_M_PI / 720.0)));
+          m_128apsk[39] = gr_complex((r4 * cos(659 * GR_M_PI / 720.0)), (r4 * sin(659 * GR_M_PI / 720.0)));
+          m_128apsk[40] = gr_complex((r1 * cos(457 * GR_M_PI / 560.0)), (r1 * sin(457 * GR_M_PI / 560.0)));
+          m_128apsk[41] = gr_complex((r6 * cos(359 * GR_M_PI / 420.0)), (r6 * sin(359 * GR_M_PI / 420.0)));
+          m_128apsk[42] = gr_complex((r6 * cos(1297 * GR_M_PI / 1680.0)), (r6 * sin(1297 * GR_M_PI / 1680.0)));
+          m_128apsk[43] = gr_complex((r6 * cos(4111 * GR_M_PI / 5040.0)), (r6 * sin(4111 * GR_M_PI / 5040.0)));
+          m_128apsk[44] = gr_complex((r2 * cos(447 * GR_M_PI / 560.0)), (r2 * sin(447 * GR_M_PI / 560.0)));
+          m_128apsk[45] = gr_complex((r3 * cos(839 * GR_M_PI / 1008.0)), (r3 * sin(839 * GR_M_PI / 1008.0)));
+          m_128apsk[46] = gr_complex((r5 * cos(1957 * GR_M_PI / 2520.0)), (r5 * sin(1957 * GR_M_PI / 2520.0)));
+          m_128apsk[47] = gr_complex((r4 * cos(701 * GR_M_PI / 840.0)), (r4 * sin(701 * GR_M_PI / 840.0)));
+          m_128apsk[48] = gr_complex((r1 * cos(317 * GR_M_PI / 560.0)), (r1 * sin(317 * GR_M_PI / 560.0)));
+          m_128apsk[49] = gr_complex((r6 * cos(3047 * GR_M_PI / 5040.0)), (r6 * sin(3047 * GR_M_PI / 5040.0)));
+          m_128apsk[50] = gr_complex((r6 * cos(47 * GR_M_PI / 90.0)), (r6 * sin(47 * GR_M_PI / 90.0)));
+          m_128apsk[51] = gr_complex((r6 * cos(95 * GR_M_PI / 168.0)), (r6 * sin(95 * GR_M_PI / 168.0)));
+          m_128apsk[52] = gr_complex((r2 * cos(1381 * GR_M_PI / 2520.0)), (r2 * sin(1381 * GR_M_PI / 2520.0)));
+          m_128apsk[53] = gr_complex((r3 * cos(163 * GR_M_PI / 280.0)), (r3 * sin(163 * GR_M_PI / 280.0)));
+          m_128apsk[54] = gr_complex((r5 * cos(379 * GR_M_PI / 720.0)), (r5 * sin(379 * GR_M_PI / 720.0)));
+          m_128apsk[55] = gr_complex((r4 * cos(491 * GR_M_PI / 840.0)), (r4 * sin(491 * GR_M_PI / 840.0)));
+          m_128apsk[56] = gr_complex((r1 * cos(383 * GR_M_PI / 560.0)), (r1 * sin(383 * GR_M_PI / 560.0)));
+          m_128apsk[57] = gr_complex((r6 * cos(3251 * GR_M_PI / 5040.0)), (r6 * sin(3251 * GR_M_PI / 5040.0)));
+          m_128apsk[58] = gr_complex((r6 * cos(131 * GR_M_PI / 180.0)), (r6 * sin(131 * GR_M_PI / 180.0)));
+          m_128apsk[59] = gr_complex((r6 * cos(115 * GR_M_PI / 168.0)), (r6 * sin(115 * GR_M_PI / 168.0)));
+          m_128apsk[60] = gr_complex((r2 * cos(393 * GR_M_PI / 560.0)), (r2 * sin(393 * GR_M_PI / 560.0)));
+          m_128apsk[61] = gr_complex((r3 * cos(481 * GR_M_PI / 720.0)), (r3 * sin(481 * GR_M_PI / 720.0)));
+          m_128apsk[62] = gr_complex((r5 * cos(521 * GR_M_PI / 720.0)), (r5 * sin(521 * GR_M_PI / 720.0)));
+          m_128apsk[63] = gr_complex((r4 * cos(559 * GR_M_PI / 840.0)), (r4 * sin(559 * GR_M_PI / 840.0)));
+          m_128apsk[64] = gr_complex((r1 * cos(2437 * GR_M_PI / 1260.0)), (r1 * sin(2437 * GR_M_PI / 1260.0)));
+          m_128apsk[65] = gr_complex((r6 * cos(199 * GR_M_PI / 105.0)), (r6 * sin(199 * GR_M_PI / 105.0)));
+          m_128apsk[66] = gr_complex((r6 * cos(3323 * GR_M_PI / 1680.0)), (r6 * sin(3323 * GR_M_PI / 1680.0)));
+          m_128apsk[67] = gr_complex((r6 * cos(325 * GR_M_PI / 168.0)), (r6 * sin(325 * GR_M_PI / 168.0)));
+          m_128apsk[68] = gr_complex((r2 * cos(4919 * GR_M_PI / 2520.0)), (r2 * sin(4919 * GR_M_PI / 2520.0)));
+          m_128apsk[69] = gr_complex((r3 * cos(537 * GR_M_PI / 280.0)), (r3 * sin(537 * GR_M_PI / 280.0)));
+          m_128apsk[70] = gr_complex((r5 * cos(1421 * GR_M_PI / 720.0)), (r5 * sin(1421 * GR_M_PI / 720.0)));
+          m_128apsk[71] = gr_complex((r4 * cos(1379 * GR_M_PI / 720.0)), (r4 * sin(1379 * GR_M_PI / 720.0)));
+          m_128apsk[72] = gr_complex((r1 * cos(1017 * GR_M_PI / 560.0)), (r1 * sin(1017 * GR_M_PI / 560.0)));
+          m_128apsk[73] = gr_complex((r6 * cos(779 * GR_M_PI / 420.0)), (r6 * sin(779 * GR_M_PI / 420.0)));
+          m_128apsk[74] = gr_complex((r6 * cos(2977 * GR_M_PI / 1680.0)), (r6 * sin(2977 * GR_M_PI / 1680.0)));
+          m_128apsk[75] = gr_complex((r6 * cos(9151 * GR_M_PI / 5040.0)), (r6 * sin(9151 * GR_M_PI / 5040.0)));
+          m_128apsk[76] = gr_complex((r2 * cos(1007 * GR_M_PI / 560.0)), (r2 * sin(1007 * GR_M_PI / 560.0)));
+          m_128apsk[77] = gr_complex((r3 * cos(1847 * GR_M_PI / 1008.0)), (r3 * sin(1847 * GR_M_PI / 1008.0)));
+          m_128apsk[78] = gr_complex((r5 * cos(4477 * GR_M_PI / 2520.0)), (r5 * sin(4477 * GR_M_PI / 2520.0)));
+          m_128apsk[79] = gr_complex((r4 * cos(1541 * GR_M_PI / 840.0)), (r4 * sin(1541 * GR_M_PI / 840.0)));
+          m_128apsk[80] = gr_complex((r1 * cos(877 * GR_M_PI / 560.0)), (r1 * sin(877 * GR_M_PI / 560.0)));
+          m_128apsk[81] = gr_complex((r6 * cos(8087 * GR_M_PI / 5040.0)), (r6 * sin(8087 * GR_M_PI / 5040.0)));
+          m_128apsk[82] = gr_complex((r6 * cos(137 * GR_M_PI / 90.0)), (r6 * sin(137 * GR_M_PI / 90.0)));
+          m_128apsk[83] = gr_complex((r6 * cos(263 * GR_M_PI / 168.0)), (r6 * sin(263 * GR_M_PI / 168.0)));
+          m_128apsk[84] = gr_complex((r2 * cos(3901 * GR_M_PI / 2520.0)), (r2 * sin(3901 * GR_M_PI / 2520.0)));
+          m_128apsk[85] = gr_complex((r3 * cos(443 * GR_M_PI / 280.0)), (r3 * sin(443 * GR_M_PI / 280.0)));
+          m_128apsk[86] = gr_complex((r5 * cos(1099 * GR_M_PI / 720.0)), (r5 * sin(1099 * GR_M_PI / 720.0)));
+          m_128apsk[87] = gr_complex((r4 * cos(1331 * GR_M_PI / 840.0)), (r4 * sin(1331 * GR_M_PI / 840.0)));
+          m_128apsk[88] = gr_complex((r1 * cos(943 * GR_M_PI / 560.0)), (r1 * sin(943 * GR_M_PI / 560.0)));
+          m_128apsk[89] = gr_complex((r6 * cos(8291 * GR_M_PI / 5040.0)), (r6 * sin(8291 * GR_M_PI / 5040.0)));
+          m_128apsk[90] = gr_complex((r6 * cos(311 * GR_M_PI / 180.0)), (r6 * sin(311 * GR_M_PI / 180.0)));
+          m_128apsk[91] = gr_complex((r6 * cos(283 * GR_M_PI / 168.0)), (r6 * sin(283 * GR_M_PI / 168.0)));
+          m_128apsk[92] = gr_complex((r2 * cos(953 * GR_M_PI / 560.0)), (r2 * sin(953 * GR_M_PI / 560.0)));
+          m_128apsk[93] = gr_complex((r3 * cos(1201 * GR_M_PI / 720.0)), (r3 * sin(1201 * GR_M_PI / 720.0)));
+          m_128apsk[94] = gr_complex((r5 * cos(1241 * GR_M_PI / 720.0)), (r5 * sin(1241 * GR_M_PI / 720.0)));
+          m_128apsk[95] = gr_complex((r4 * cos(1399 * GR_M_PI / 840.0)), (r4 * sin(1399 * GR_M_PI / 840.0)));
+          m_128apsk[96] = gr_complex((r1 * cos(1343 * GR_M_PI / 1260.0)), (r1 * sin(1343 * GR_M_PI / 1260.0)));
+          m_128apsk[97] = gr_complex((r6 * cos(116 * GR_M_PI / 105.0)), (r6 * sin(116 * GR_M_PI / 105.0)));
+          m_128apsk[98] = gr_complex((r6 * cos(1717 * GR_M_PI / 1680.0)), (r6 * sin(1717 * GR_M_PI / 1680.0)));
+          m_128apsk[99] = gr_complex((r6 * cos(179 * GR_M_PI / 168.0)), (r6 * sin(179 * GR_M_PI / 168.0)));
+          m_128apsk[100] = gr_complex((r2 * cos(2641 * GR_M_PI / 2520.0)), (r2 * sin(2641 * GR_M_PI / 2520.0)));
+          m_128apsk[101] = gr_complex((r3 * cos(303 * GR_M_PI / 280.0)), (r3 * sin(303 * GR_M_PI / 280.0)));
+          m_128apsk[102] = gr_complex((r5 * cos(739 * GR_M_PI / 720.0)), (r5 * sin(739 * GR_M_PI / 720.0)));
+          m_128apsk[103] = gr_complex((r4 * cos(781 * GR_M_PI / 720.0)), (r4 * sin(781 * GR_M_PI / 720.0)));
+          m_128apsk[104] = gr_complex((r1 * cos(663 * GR_M_PI / 560.0)), (r1 * sin(663 * GR_M_PI / 560.0)));
+          m_128apsk[105] = gr_complex((r6 * cos(481 * GR_M_PI / 420.0)), (r6 * sin(481 * GR_M_PI / 420.0)));
+          m_128apsk[106] = gr_complex((r6 * cos(2063 * GR_M_PI / 1680.0)), (r6 * sin(2063 * GR_M_PI / 1680.0)));
+          m_128apsk[107] = gr_complex((r6 * cos(5969 * GR_M_PI / 5040.0)), (r6 * sin(5969 * GR_M_PI / 5040.0)));
+          m_128apsk[108] = gr_complex((r2 * cos(673 * GR_M_PI / 560.0)), (r2 * sin(673 * GR_M_PI / 560.0)));
+          m_128apsk[109] = gr_complex((r3 * cos(1177 * GR_M_PI / 1008.0)), (r3 * sin(1177 * GR_M_PI / 1008.0)));
+          m_128apsk[110] = gr_complex((r5 * cos(3083 * GR_M_PI / 2520.0)), (r5 * sin(3083 * GR_M_PI / 2520.0)));
+          m_128apsk[111] = gr_complex((r4 * cos(979 * GR_M_PI / 840.0)), (r4 * sin(979 * GR_M_PI / 840.0)));
+          m_128apsk[112] = gr_complex((r1 * cos(803 * GR_M_PI / 560.0)), (r1 * sin(803 * GR_M_PI / 560.0)));
+          m_128apsk[113] = gr_complex((r6 * cos(7033 * GR_M_PI / 5040.0)), (r6 * sin(7033 * GR_M_PI / 5040.0)));
+          m_128apsk[114] = gr_complex((r6 * cos(133 * GR_M_PI / 90.0)), (r6 * sin(133 * GR_M_PI / 90.0)));
+          m_128apsk[115] = gr_complex((r6 * cos(241 * GR_M_PI / 168.0)), (r6 * sin(241 * GR_M_PI / 168.0)));
+          m_128apsk[116] = gr_complex((r2 * cos(3659 * GR_M_PI / 2520.0)), (r2 * sin(3659 * GR_M_PI / 2520.0)));
+          m_128apsk[117] = gr_complex((r3 * cos(397 * GR_M_PI / 280.0)), (r3 * sin(397 * GR_M_PI / 280.0)));
+          m_128apsk[118] = gr_complex((r5 * cos(1061 * GR_M_PI / 720.0)), (r5 * sin(1061 * GR_M_PI / 720.0)));
+          m_128apsk[119] = gr_complex((r4 * cos(1189 * GR_M_PI / 840.0)), (r4 * sin(1189 * GR_M_PI / 840.0)));
+          m_128apsk[120] = gr_complex((r1 * cos(737 * GR_M_PI / 560.0)), (r1 * sin(737 * GR_M_PI / 560.0)));
+          m_128apsk[121] = gr_complex((r6 * cos(6829 * GR_M_PI / 5040.0)), (r6 * sin(6829 * GR_M_PI / 5040.0)));
+          m_128apsk[122] = gr_complex((r6 * cos(229 * GR_M_PI / 180.0)), (r6 * sin(229 * GR_M_PI / 180.0)));
+          m_128apsk[123] = gr_complex((r6 * cos(221 * GR_M_PI / 168.0)), (r6 * sin(221 * GR_M_PI / 168.0)));
+          m_128apsk[124] = gr_complex((r2 * cos(727 * GR_M_PI / 560.0)), (r2 * sin(727 * GR_M_PI / 560.0)));
+          m_128apsk[125] = gr_complex((r3 * cos(959 * GR_M_PI / 720.0)), (r3 * sin(959 * GR_M_PI / 720.0)));
+          m_128apsk[126] = gr_complex((r5 * cos(919 * GR_M_PI / 720.0)), (r5 * sin(919 * GR_M_PI / 720.0)));
+          m_128apsk[127] = gr_complex((r4 * cos(1121 * GR_M_PI / 840.0)), (r4 * sin(1121 * GR_M_PI / 840.0)));
           break;
         case MOD_256APSK:
           if (rate == C20_30) {
@@ -1397,262 +1398,262 @@ namespace gr {
                 r7 = 0;
                 break;
             }
-            m_256apsk[0] = gr_complex((r1 * cos(M_PI / 32.0)), (r1 * sin(M_PI / 32.0)));
-            m_256apsk[1] = gr_complex((r1 * cos(3 * M_PI / 32.0)), (r1 * sin(3 * M_PI / 32.0)));
-            m_256apsk[2] = gr_complex((r1 * cos(7 * M_PI / 32.0)), (r1 * sin(7 * M_PI / 32.0)));
-            m_256apsk[3] = gr_complex((r1 * cos(5 * M_PI / 32.0)), (r1 * sin(5 * M_PI / 32.0)));
-            m_256apsk[4] = gr_complex((r1 * cos(15 * M_PI / 32.0)), (r1 * sin(15 * M_PI / 32.0)));
-            m_256apsk[5] = gr_complex((r1 * cos(13 * M_PI / 32.0)), (r1 * sin(13 * M_PI / 32.0)));
-            m_256apsk[6] = gr_complex((r1 * cos(9 * M_PI / 32.0)), (r1 * sin(9 * M_PI / 32.0)));
-            m_256apsk[7] = gr_complex((r1 * cos(11 * M_PI / 32.0)), (r1 * sin(11 * M_PI / 32.0)));
-            m_256apsk[8] = gr_complex((r1 * cos(31 * M_PI / 32.0)), (r1 * sin(31 * M_PI / 32.0)));
-            m_256apsk[9] = gr_complex((r1 * cos(29 * M_PI / 32.0)), (r1 * sin(29 * M_PI / 32.0)));
-            m_256apsk[10] = gr_complex((r1 * cos(25 * M_PI / 32.0)), (r1 * sin(25 * M_PI / 32.0)));
-            m_256apsk[11] = gr_complex((r1 * cos(27 * M_PI / 32.0)), (r1 * sin(27 * M_PI / 32.0)));
-            m_256apsk[12] = gr_complex((r1 * cos(17 * M_PI / 32.0)), (r1 * sin(17 * M_PI / 32.0)));
-            m_256apsk[13] = gr_complex((r1 * cos(19 * M_PI / 32.0)), (r1 * sin(19 * M_PI / 32.0)));
-            m_256apsk[14] = gr_complex((r1 * cos(23 * M_PI / 32.0)), (r1 * sin(23 * M_PI / 32.0)));
-            m_256apsk[15] = gr_complex((r1 * cos(21 * M_PI / 32.0)), (r1 * sin(21 * M_PI / 32.0)));
-            m_256apsk[16] = gr_complex((r1 * cos(-1 * M_PI / 32.0)), (r1 * sin(-1 * M_PI / 32.0)));
-            m_256apsk[17] = gr_complex((r1 * cos(-3 * M_PI / 32.0)), (r1 * sin(-3 * M_PI / 32.0)));
-            m_256apsk[18] = gr_complex((r1 * cos(-7 * M_PI / 32.0)), (r1 * sin(-7 * M_PI / 32.0)));
-            m_256apsk[19] = gr_complex((r1 * cos(-5 * M_PI / 32.0)), (r1 * sin(-5 * M_PI / 32.0)));
-            m_256apsk[20] = gr_complex((r1 * cos(-15 * M_PI / 32.0)), (r1 * sin(-15 * M_PI / 32.0)));
-            m_256apsk[21] = gr_complex((r1 * cos(-13 * M_PI / 32.0)), (r1 * sin(-13 * M_PI / 32.0)));
-            m_256apsk[22] = gr_complex((r1 * cos(-9 * M_PI / 32.0)), (r1 * sin(-9 * M_PI / 32.0)));
-            m_256apsk[23] = gr_complex((r1 * cos(-11 * M_PI / 32.0)), (r1 * sin(-11 * M_PI / 32.0)));
-            m_256apsk[24] = gr_complex((r1 * cos(33 * M_PI / 32.0)), (r1 * sin(33 * M_PI / 32.0)));
-            m_256apsk[25] = gr_complex((r1 * cos(35 * M_PI / 32.0)), (r1 * sin(35 * M_PI / 32.0)));
-            m_256apsk[26] = gr_complex((r1 * cos(39 * M_PI / 32.0)), (r1 * sin(39 * M_PI / 32.0)));
-            m_256apsk[27] = gr_complex((r1 * cos(37 * M_PI / 32.0)), (r1 * sin(37 * M_PI / 32.0)));
-            m_256apsk[28] = gr_complex((r1 * cos(47 * M_PI / 32.0)), (r1 * sin(47 * M_PI / 32.0)));
-            m_256apsk[29] = gr_complex((r1 * cos(45 * M_PI / 32.0)), (r1 * sin(45 * M_PI / 32.0)));
-            m_256apsk[30] = gr_complex((r1 * cos(41 * M_PI / 32.0)), (r1 * sin(41 * M_PI / 32.0)));
-            m_256apsk[31] = gr_complex((r1 * cos(43 * M_PI / 32.0)), (r1 * sin(43 * M_PI / 32.0)));
-            m_256apsk[32] = gr_complex((r2 * cos(M_PI / 32.0)), (r2 * sin(M_PI / 32.0)));
-            m_256apsk[33] = gr_complex((r2 * cos(3 * M_PI / 32.0)), (r2 * sin(3 * M_PI / 32.0)));
-            m_256apsk[34] = gr_complex((r2 * cos(7 * M_PI / 32.0)), (r2 * sin(7 * M_PI / 32.0)));
-            m_256apsk[35] = gr_complex((r2 * cos(5 * M_PI / 32.0)), (r2 * sin(5 * M_PI / 32.0)));
-            m_256apsk[36] = gr_complex((r2 * cos(15 * M_PI / 32.0)), (r2 * sin(15 * M_PI / 32.0)));
-            m_256apsk[37] = gr_complex((r2 * cos(13 * M_PI / 32.0)), (r2 * sin(13 * M_PI / 32.0)));
-            m_256apsk[38] = gr_complex((r2 * cos(9 * M_PI / 32.0)), (r2 * sin(9 * M_PI / 32.0)));
-            m_256apsk[39] = gr_complex((r2 * cos(11 * M_PI / 32.0)), (r2 * sin(11 * M_PI / 32.0)));
-            m_256apsk[40] = gr_complex((r2 * cos(31 * M_PI / 32.0)), (r2 * sin(31 * M_PI / 32.0)));
-            m_256apsk[41] = gr_complex((r2 * cos(29 * M_PI / 32.0)), (r2 * sin(29 * M_PI / 32.0)));
-            m_256apsk[42] = gr_complex((r2 * cos(25 * M_PI / 32.0)), (r2 * sin(25 * M_PI / 32.0)));
-            m_256apsk[43] = gr_complex((r2 * cos(27 * M_PI / 32.0)), (r2 * sin(27 * M_PI / 32.0)));
-            m_256apsk[44] = gr_complex((r2 * cos(17 * M_PI / 32.0)), (r2 * sin(17 * M_PI / 32.0)));
-            m_256apsk[45] = gr_complex((r2 * cos(19 * M_PI / 32.0)), (r2 * sin(19 * M_PI / 32.0)));
-            m_256apsk[46] = gr_complex((r2 * cos(23 * M_PI / 32.0)), (r2 * sin(23 * M_PI / 32.0)));
-            m_256apsk[47] = gr_complex((r2 * cos(21 * M_PI / 32.0)), (r2 * sin(21 * M_PI / 32.0)));
-            m_256apsk[48] = gr_complex((r2 * cos(-1 * M_PI / 32.0)), (r2 * sin(-1 * M_PI / 32.0)));
-            m_256apsk[49] = gr_complex((r2 * cos(-3 * M_PI / 32.0)), (r2 * sin(-3 * M_PI / 32.0)));
-            m_256apsk[50] = gr_complex((r2 * cos(-7 * M_PI / 32.0)), (r2 * sin(-7 * M_PI / 32.0)));
-            m_256apsk[51] = gr_complex((r2 * cos(-5 * M_PI / 32.0)), (r2 * sin(-5 * M_PI / 32.0)));
-            m_256apsk[52] = gr_complex((r2 * cos(-15 * M_PI / 32.0)), (r2 * sin(-15 * M_PI / 32.0)));
-            m_256apsk[53] = gr_complex((r2 * cos(-13 * M_PI / 32.0)), (r2 * sin(-13 * M_PI / 32.0)));
-            m_256apsk[54] = gr_complex((r2 * cos(-9 * M_PI / 32.0)), (r2 * sin(-9 * M_PI / 32.0)));
-            m_256apsk[55] = gr_complex((r2 * cos(-11 * M_PI / 32.0)), (r2 * sin(-11 * M_PI / 32.0)));
-            m_256apsk[56] = gr_complex((r2 * cos(33 * M_PI / 32.0)), (r2 * sin(33 * M_PI / 32.0)));
-            m_256apsk[57] = gr_complex((r2 * cos(35 * M_PI / 32.0)), (r2 * sin(35 * M_PI / 32.0)));
-            m_256apsk[58] = gr_complex((r2 * cos(39 * M_PI / 32.0)), (r2 * sin(39 * M_PI / 32.0)));
-            m_256apsk[59] = gr_complex((r2 * cos(37 * M_PI / 32.0)), (r2 * sin(37 * M_PI / 32.0)));
-            m_256apsk[60] = gr_complex((r2 * cos(47 * M_PI / 32.0)), (r2 * sin(47 * M_PI / 32.0)));
-            m_256apsk[61] = gr_complex((r2 * cos(45 * M_PI / 32.0)), (r2 * sin(45 * M_PI / 32.0)));
-            m_256apsk[62] = gr_complex((r2 * cos(41 * M_PI / 32.0)), (r2 * sin(41 * M_PI / 32.0)));
-            m_256apsk[63] = gr_complex((r2 * cos(43 * M_PI / 32.0)), (r2 * sin(43 * M_PI / 32.0)));
-            m_256apsk[64] = gr_complex((r4 * cos(M_PI / 32.0)), (r4 * sin(M_PI / 32.0)));
-            m_256apsk[65] = gr_complex((r4 * cos(3 * M_PI / 32.0)), (r4 * sin(3 * M_PI / 32.0)));
-            m_256apsk[66] = gr_complex((r4 * cos(7 * M_PI / 32.0)), (r4 * sin(7 * M_PI / 32.0)));
-            m_256apsk[67] = gr_complex((r4 * cos(5 * M_PI / 32.0)), (r4 * sin(5 * M_PI / 32.0)));
-            m_256apsk[68] = gr_complex((r4 * cos(15 * M_PI / 32.0)), (r4 * sin(15 * M_PI / 32.0)));
-            m_256apsk[69] = gr_complex((r4 * cos(13 * M_PI / 32.0)), (r4 * sin(13 * M_PI / 32.0)));
-            m_256apsk[70] = gr_complex((r4 * cos(9 * M_PI / 32.0)), (r4 * sin(9 * M_PI / 32.0)));
-            m_256apsk[71] = gr_complex((r4 * cos(11 * M_PI / 32.0)), (r4 * sin(11 * M_PI / 32.0)));
-            m_256apsk[72] = gr_complex((r4 * cos(31 * M_PI / 32.0)), (r4 * sin(31 * M_PI / 32.0)));
-            m_256apsk[73] = gr_complex((r4 * cos(29 * M_PI / 32.0)), (r4 * sin(29 * M_PI / 32.0)));
-            m_256apsk[74] = gr_complex((r4 * cos(25 * M_PI / 32.0)), (r4 * sin(25 * M_PI / 32.0)));
-            m_256apsk[75] = gr_complex((r4 * cos(27 * M_PI / 32.0)), (r4 * sin(27 * M_PI / 32.0)));
-            m_256apsk[76] = gr_complex((r4 * cos(17 * M_PI / 32.0)), (r4 * sin(17 * M_PI / 32.0)));
-            m_256apsk[77] = gr_complex((r4 * cos(19 * M_PI / 32.0)), (r4 * sin(19 * M_PI / 32.0)));
-            m_256apsk[78] = gr_complex((r4 * cos(23 * M_PI / 32.0)), (r4 * sin(23 * M_PI / 32.0)));
-            m_256apsk[79] = gr_complex((r4 * cos(21 * M_PI / 32.0)), (r4 * sin(21 * M_PI / 32.0)));
-            m_256apsk[80] = gr_complex((r4 * cos(-1 * M_PI / 32.0)), (r4 * sin(-1 * M_PI / 32.0)));
-            m_256apsk[81] = gr_complex((r4 * cos(-3 * M_PI / 32.0)), (r4 * sin(-3 * M_PI / 32.0)));
-            m_256apsk[82] = gr_complex((r4 * cos(-7 * M_PI / 32.0)), (r4 * sin(-7 * M_PI / 32.0)));
-            m_256apsk[83] = gr_complex((r4 * cos(-5 * M_PI / 32.0)), (r4 * sin(-5 * M_PI / 32.0)));
-            m_256apsk[84] = gr_complex((r4 * cos(-15 * M_PI / 32.0)), (r4 * sin(-15 * M_PI / 32.0)));
-            m_256apsk[85] = gr_complex((r4 * cos(-13 * M_PI / 32.0)), (r4 * sin(-13 * M_PI / 32.0)));
-            m_256apsk[86] = gr_complex((r4 * cos(-9 * M_PI / 32.0)), (r4 * sin(-9 * M_PI / 32.0)));
-            m_256apsk[87] = gr_complex((r4 * cos(-11 * M_PI / 32.0)), (r4 * sin(-11 * M_PI / 32.0)));
-            m_256apsk[88] = gr_complex((r4 * cos(33 * M_PI / 32.0)), (r4 * sin(33 * M_PI / 32.0)));
-            m_256apsk[89] = gr_complex((r4 * cos(35 * M_PI / 32.0)), (r4 * sin(35 * M_PI / 32.0)));
-            m_256apsk[90] = gr_complex((r4 * cos(39 * M_PI / 32.0)), (r4 * sin(39 * M_PI / 32.0)));
-            m_256apsk[91] = gr_complex((r4 * cos(37 * M_PI / 32.0)), (r4 * sin(37 * M_PI / 32.0)));
-            m_256apsk[92] = gr_complex((r4 * cos(47 * M_PI / 32.0)), (r4 * sin(47 * M_PI / 32.0)));
-            m_256apsk[93] = gr_complex((r4 * cos(45 * M_PI / 32.0)), (r4 * sin(45 * M_PI / 32.0)));
-            m_256apsk[94] = gr_complex((r4 * cos(41 * M_PI / 32.0)), (r4 * sin(41 * M_PI / 32.0)));
-            m_256apsk[95] = gr_complex((r4 * cos(43 * M_PI / 32.0)), (r4 * sin(43 * M_PI / 32.0)));
-            m_256apsk[96] = gr_complex((r3 * cos(M_PI / 32.0)), (r3 * sin(M_PI / 32.0)));
-            m_256apsk[97] = gr_complex((r3 * cos(3 * M_PI / 32.0)), (r3 * sin(3 * M_PI / 32.0)));
-            m_256apsk[98] = gr_complex((r3 * cos(7 * M_PI / 32.0)), (r3 * sin(7 * M_PI / 32.0)));
-            m_256apsk[99] = gr_complex((r3 * cos(5 * M_PI / 32.0)), (r3 * sin(5 * M_PI / 32.0)));
-            m_256apsk[100] = gr_complex((r3 * cos(15 * M_PI / 32.0)), (r3 * sin(15 * M_PI / 32.0)));
-            m_256apsk[101] = gr_complex((r3 * cos(13 * M_PI / 32.0)), (r3 * sin(13 * M_PI / 32.0)));
-            m_256apsk[102] = gr_complex((r3 * cos(9 * M_PI / 32.0)), (r3 * sin(9 * M_PI / 32.0)));
-            m_256apsk[103] = gr_complex((r3 * cos(11 * M_PI / 32.0)), (r3 * sin(11 * M_PI / 32.0)));
-            m_256apsk[104] = gr_complex((r3 * cos(31 * M_PI / 32.0)), (r3 * sin(31 * M_PI / 32.0)));
-            m_256apsk[105] = gr_complex((r3 * cos(29 * M_PI / 32.0)), (r3 * sin(29 * M_PI / 32.0)));
-            m_256apsk[106] = gr_complex((r3 * cos(25 * M_PI / 32.0)), (r3 * sin(25 * M_PI / 32.0)));
-            m_256apsk[107] = gr_complex((r3 * cos(27 * M_PI / 32.0)), (r3 * sin(27 * M_PI / 32.0)));
-            m_256apsk[108] = gr_complex((r3 * cos(17 * M_PI / 32.0)), (r3 * sin(17 * M_PI / 32.0)));
-            m_256apsk[109] = gr_complex((r3 * cos(19 * M_PI / 32.0)), (r3 * sin(19 * M_PI / 32.0)));
-            m_256apsk[110] = gr_complex((r3 * cos(23 * M_PI / 32.0)), (r3 * sin(23 * M_PI / 32.0)));
-            m_256apsk[111] = gr_complex((r3 * cos(21 * M_PI / 32.0)), (r3 * sin(21 * M_PI / 32.0)));
-            m_256apsk[112] = gr_complex((r3 * cos(-1 * M_PI / 32.0)), (r3 * sin(-1 * M_PI / 32.0)));
-            m_256apsk[113] = gr_complex((r3 * cos(-3 * M_PI / 32.0)), (r3 * sin(-3 * M_PI / 32.0)));
-            m_256apsk[114] = gr_complex((r3 * cos(-7 * M_PI / 32.0)), (r3 * sin(-7 * M_PI / 32.0)));
-            m_256apsk[115] = gr_complex((r3 * cos(-5 * M_PI / 32.0)), (r3 * sin(-5 * M_PI / 32.0)));
-            m_256apsk[116] = gr_complex((r3 * cos(-15 * M_PI / 32.0)), (r3 * sin(-15 * M_PI / 32.0)));
-            m_256apsk[117] = gr_complex((r3 * cos(-13 * M_PI / 32.0)), (r3 * sin(-13 * M_PI / 32.0)));
-            m_256apsk[118] = gr_complex((r3 * cos(-9 * M_PI / 32.0)), (r3 * sin(-9 * M_PI / 32.0)));
-            m_256apsk[119] = gr_complex((r3 * cos(-11 * M_PI / 32.0)), (r3 * sin(-11 * M_PI / 32.0)));
-            m_256apsk[120] = gr_complex((r3 * cos(33 * M_PI / 32.0)), (r3 * sin(33 * M_PI / 32.0)));
-            m_256apsk[121] = gr_complex((r3 * cos(35 * M_PI / 32.0)), (r3 * sin(35 * M_PI / 32.0)));
-            m_256apsk[122] = gr_complex((r3 * cos(39 * M_PI / 32.0)), (r3 * sin(39 * M_PI / 32.0)));
-            m_256apsk[123] = gr_complex((r3 * cos(37 * M_PI / 32.0)), (r3 * sin(37 * M_PI / 32.0)));
-            m_256apsk[124] = gr_complex((r3 * cos(47 * M_PI / 32.0)), (r3 * sin(47 * M_PI / 32.0)));
-            m_256apsk[125] = gr_complex((r3 * cos(45 * M_PI / 32.0)), (r3 * sin(45 * M_PI / 32.0)));
-            m_256apsk[126] = gr_complex((r3 * cos(41 * M_PI / 32.0)), (r3 * sin(41 * M_PI / 32.0)));
-            m_256apsk[127] = gr_complex((r3 * cos(43 * M_PI / 32.0)), (r3 * sin(43 * M_PI / 32.0)));
-            m_256apsk[128] = gr_complex((r8 * cos(M_PI / 32.0)), (r8 * sin(M_PI / 32.0)));
-            m_256apsk[129] = gr_complex((r8 * cos(3 * M_PI / 32.0)), (r8 * sin(3 * M_PI / 32.0)));
-            m_256apsk[130] = gr_complex((r8 * cos(7 * M_PI / 32.0)), (r8 * sin(7 * M_PI / 32.0)));
-            m_256apsk[131] = gr_complex((r8 * cos(5 * M_PI / 32.0)), (r8 * sin(5 * M_PI / 32.0)));
-            m_256apsk[132] = gr_complex((r8 * cos(15 * M_PI / 32.0)), (r8 * sin(15 * M_PI / 32.0)));
-            m_256apsk[133] = gr_complex((r8 * cos(13 * M_PI / 32.0)), (r8 * sin(13 * M_PI / 32.0)));
-            m_256apsk[134] = gr_complex((r8 * cos(9 * M_PI / 32.0)), (r8 * sin(9 * M_PI / 32.0)));
-            m_256apsk[135] = gr_complex((r8 * cos(11 * M_PI / 32.0)), (r8 * sin(11 * M_PI / 32.0)));
-            m_256apsk[136] = gr_complex((r8 * cos(31 * M_PI / 32.0)), (r8 * sin(31 * M_PI / 32.0)));
-            m_256apsk[137] = gr_complex((r8 * cos(29 * M_PI / 32.0)), (r8 * sin(29 * M_PI / 32.0)));
-            m_256apsk[138] = gr_complex((r8 * cos(25 * M_PI / 32.0)), (r8 * sin(25 * M_PI / 32.0)));
-            m_256apsk[139] = gr_complex((r8 * cos(27 * M_PI / 32.0)), (r8 * sin(27 * M_PI / 32.0)));
-            m_256apsk[140] = gr_complex((r8 * cos(17 * M_PI / 32.0)), (r8 * sin(17 * M_PI / 32.0)));
-            m_256apsk[141] = gr_complex((r8 * cos(19 * M_PI / 32.0)), (r8 * sin(19 * M_PI / 32.0)));
-            m_256apsk[142] = gr_complex((r8 * cos(23 * M_PI / 32.0)), (r8 * sin(23 * M_PI / 32.0)));
-            m_256apsk[143] = gr_complex((r8 * cos(21 * M_PI / 32.0)), (r8 * sin(21 * M_PI / 32.0)));
-            m_256apsk[144] = gr_complex((r8 * cos(-1 * M_PI / 32.0)), (r8 * sin(-1 * M_PI / 32.0)));
-            m_256apsk[145] = gr_complex((r8 * cos(-3 * M_PI / 32.0)), (r8 * sin(-3 * M_PI / 32.0)));
-            m_256apsk[146] = gr_complex((r8 * cos(-7 * M_PI / 32.0)), (r8 * sin(-7 * M_PI / 32.0)));
-            m_256apsk[147] = gr_complex((r8 * cos(-5 * M_PI / 32.0)), (r8 * sin(-5 * M_PI / 32.0)));
-            m_256apsk[148] = gr_complex((r8 * cos(-15 * M_PI / 32.0)), (r8 * sin(-15 * M_PI / 32.0)));
-            m_256apsk[149] = gr_complex((r8 * cos(-13 * M_PI / 32.0)), (r8 * sin(-13 * M_PI / 32.0)));
-            m_256apsk[150] = gr_complex((r8 * cos(-9 * M_PI / 32.0)), (r8 * sin(-9 * M_PI / 32.0)));
-            m_256apsk[151] = gr_complex((r8 * cos(-11 * M_PI / 32.0)), (r8 * sin(-11 * M_PI / 32.0)));
-            m_256apsk[152] = gr_complex((r8 * cos(33 * M_PI / 32.0)), (r8 * sin(33 * M_PI / 32.0)));
-            m_256apsk[153] = gr_complex((r8 * cos(35 * M_PI / 32.0)), (r8 * sin(35 * M_PI / 32.0)));
-            m_256apsk[154] = gr_complex((r8 * cos(39 * M_PI / 32.0)), (r8 * sin(39 * M_PI / 32.0)));
-            m_256apsk[155] = gr_complex((r8 * cos(37 * M_PI / 32.0)), (r8 * sin(37 * M_PI / 32.0)));
-            m_256apsk[156] = gr_complex((r8 * cos(47 * M_PI / 32.0)), (r8 * sin(47 * M_PI / 32.0)));
-            m_256apsk[157] = gr_complex((r8 * cos(45 * M_PI / 32.0)), (r8 * sin(45 * M_PI / 32.0)));
-            m_256apsk[158] = gr_complex((r8 * cos(41 * M_PI / 32.0)), (r8 * sin(41 * M_PI / 32.0)));
-            m_256apsk[159] = gr_complex((r8 * cos(43 * M_PI / 32.0)), (r8 * sin(43 * M_PI / 32.0)));
-            m_256apsk[160] = gr_complex((r7 * cos(M_PI / 32.0)), (r7 * sin(M_PI / 32.0)));
-            m_256apsk[161] = gr_complex((r7 * cos(3 * M_PI / 32.0)), (r7 * sin(3 * M_PI / 32.0)));
-            m_256apsk[162] = gr_complex((r7 * cos(7 * M_PI / 32.0)), (r7 * sin(7 * M_PI / 32.0)));
-            m_256apsk[163] = gr_complex((r7 * cos(5 * M_PI / 32.0)), (r7 * sin(5 * M_PI / 32.0)));
-            m_256apsk[164] = gr_complex((r7 * cos(15 * M_PI / 32.0)), (r7 * sin(15 * M_PI / 32.0)));
-            m_256apsk[165] = gr_complex((r7 * cos(13 * M_PI / 32.0)), (r7 * sin(13 * M_PI / 32.0)));
-            m_256apsk[166] = gr_complex((r7 * cos(9 * M_PI / 32.0)), (r7 * sin(9 * M_PI / 32.0)));
-            m_256apsk[167] = gr_complex((r7 * cos(11 * M_PI / 32.0)), (r7 * sin(11 * M_PI / 32.0)));
-            m_256apsk[168] = gr_complex((r7 * cos(31 * M_PI / 32.0)), (r7 * sin(31 * M_PI / 32.0)));
-            m_256apsk[169] = gr_complex((r7 * cos(29 * M_PI / 32.0)), (r7 * sin(29 * M_PI / 32.0)));
-            m_256apsk[170] = gr_complex((r7 * cos(25 * M_PI / 32.0)), (r7 * sin(25 * M_PI / 32.0)));
-            m_256apsk[171] = gr_complex((r7 * cos(27 * M_PI / 32.0)), (r7 * sin(27 * M_PI / 32.0)));
-            m_256apsk[172] = gr_complex((r7 * cos(17 * M_PI / 32.0)), (r7 * sin(17 * M_PI / 32.0)));
-            m_256apsk[173] = gr_complex((r7 * cos(19 * M_PI / 32.0)), (r7 * sin(19 * M_PI / 32.0)));
-            m_256apsk[174] = gr_complex((r7 * cos(23 * M_PI / 32.0)), (r7 * sin(23 * M_PI / 32.0)));
-            m_256apsk[175] = gr_complex((r7 * cos(21 * M_PI / 32.0)), (r7 * sin(21 * M_PI / 32.0)));
-            m_256apsk[176] = gr_complex((r7 * cos(-1 * M_PI / 32.0)), (r7 * sin(-1 * M_PI / 32.0)));
-            m_256apsk[177] = gr_complex((r7 * cos(-3 * M_PI / 32.0)), (r7 * sin(-3 * M_PI / 32.0)));
-            m_256apsk[178] = gr_complex((r7 * cos(-7 * M_PI / 32.0)), (r7 * sin(-7 * M_PI / 32.0)));
-            m_256apsk[179] = gr_complex((r7 * cos(-5 * M_PI / 32.0)), (r7 * sin(-5 * M_PI / 32.0)));
-            m_256apsk[180] = gr_complex((r7 * cos(-15 * M_PI / 32.0)), (r7 * sin(-15 * M_PI / 32.0)));
-            m_256apsk[181] = gr_complex((r7 * cos(-13 * M_PI / 32.0)), (r7 * sin(-13 * M_PI / 32.0)));
-            m_256apsk[182] = gr_complex((r7 * cos(-9 * M_PI / 32.0)), (r7 * sin(-9 * M_PI / 32.0)));
-            m_256apsk[183] = gr_complex((r7 * cos(-11 * M_PI / 32.0)), (r7 * sin(-11 * M_PI / 32.0)));
-            m_256apsk[184] = gr_complex((r7 * cos(33 * M_PI / 32.0)), (r7 * sin(33 * M_PI / 32.0)));
-            m_256apsk[185] = gr_complex((r7 * cos(35 * M_PI / 32.0)), (r7 * sin(35 * M_PI / 32.0)));
-            m_256apsk[186] = gr_complex((r7 * cos(39 * M_PI / 32.0)), (r7 * sin(39 * M_PI / 32.0)));
-            m_256apsk[187] = gr_complex((r7 * cos(37 * M_PI / 32.0)), (r7 * sin(37 * M_PI / 32.0)));
-            m_256apsk[188] = gr_complex((r7 * cos(47 * M_PI / 32.0)), (r7 * sin(47 * M_PI / 32.0)));
-            m_256apsk[189] = gr_complex((r7 * cos(45 * M_PI / 32.0)), (r7 * sin(45 * M_PI / 32.0)));
-            m_256apsk[190] = gr_complex((r7 * cos(41 * M_PI / 32.0)), (r7 * sin(41 * M_PI / 32.0)));
-            m_256apsk[191] = gr_complex((r7 * cos(43 * M_PI / 32.0)), (r7 * sin(43 * M_PI / 32.0)));
-            m_256apsk[192] = gr_complex((r5 * cos(M_PI / 32.0)), (r5 * sin(M_PI / 32.0)));
-            m_256apsk[193] = gr_complex((r5 * cos(3 * M_PI / 32.0)), (r5 * sin(3 * M_PI / 32.0)));
-            m_256apsk[194] = gr_complex((r5 * cos(7 * M_PI / 32.0)), (r5 * sin(7 * M_PI / 32.0)));
-            m_256apsk[195] = gr_complex((r5 * cos(5 * M_PI / 32.0)), (r5 * sin(5 * M_PI / 32.0)));
-            m_256apsk[196] = gr_complex((r5 * cos(15 * M_PI / 32.0)), (r5 * sin(15 * M_PI / 32.0)));
-            m_256apsk[197] = gr_complex((r5 * cos(13 * M_PI / 32.0)), (r5 * sin(13 * M_PI / 32.0)));
-            m_256apsk[198] = gr_complex((r5 * cos(9 * M_PI / 32.0)), (r5 * sin(9 * M_PI / 32.0)));
-            m_256apsk[199] = gr_complex((r5 * cos(11 * M_PI / 32.0)), (r5 * sin(11 * M_PI / 32.0)));
-            m_256apsk[200] = gr_complex((r5 * cos(31 * M_PI / 32.0)), (r5 * sin(31 * M_PI / 32.0)));
-            m_256apsk[201] = gr_complex((r5 * cos(29 * M_PI / 32.0)), (r5 * sin(29 * M_PI / 32.0)));
-            m_256apsk[202] = gr_complex((r5 * cos(25 * M_PI / 32.0)), (r5 * sin(25 * M_PI / 32.0)));
-            m_256apsk[203] = gr_complex((r5 * cos(27 * M_PI / 32.0)), (r5 * sin(27 * M_PI / 32.0)));
-            m_256apsk[204] = gr_complex((r5 * cos(17 * M_PI / 32.0)), (r5 * sin(17 * M_PI / 32.0)));
-            m_256apsk[205] = gr_complex((r5 * cos(19 * M_PI / 32.0)), (r5 * sin(19 * M_PI / 32.0)));
-            m_256apsk[206] = gr_complex((r5 * cos(23 * M_PI / 32.0)), (r5 * sin(23 * M_PI / 32.0)));
-            m_256apsk[207] = gr_complex((r5 * cos(21 * M_PI / 32.0)), (r5 * sin(21 * M_PI / 32.0)));
-            m_256apsk[208] = gr_complex((r5 * cos(-1 * M_PI / 32.0)), (r5 * sin(-1 * M_PI / 32.0)));
-            m_256apsk[209] = gr_complex((r5 * cos(-3 * M_PI / 32.0)), (r5 * sin(-3 * M_PI / 32.0)));
-            m_256apsk[210] = gr_complex((r5 * cos(-7 * M_PI / 32.0)), (r5 * sin(-7 * M_PI / 32.0)));
-            m_256apsk[211] = gr_complex((r5 * cos(-5 * M_PI / 32.0)), (r5 * sin(-5 * M_PI / 32.0)));
-            m_256apsk[212] = gr_complex((r5 * cos(-15 * M_PI / 32.0)), (r5 * sin(-15 * M_PI / 32.0)));
-            m_256apsk[213] = gr_complex((r5 * cos(-13 * M_PI / 32.0)), (r5 * sin(-13 * M_PI / 32.0)));
-            m_256apsk[214] = gr_complex((r5 * cos(-9 * M_PI / 32.0)), (r5 * sin(-9 * M_PI / 32.0)));
-            m_256apsk[215] = gr_complex((r5 * cos(-11 * M_PI / 32.0)), (r5 * sin(-11 * M_PI / 32.0)));
-            m_256apsk[216] = gr_complex((r5 * cos(33 * M_PI / 32.0)), (r5 * sin(33 * M_PI / 32.0)));
-            m_256apsk[217] = gr_complex((r5 * cos(35 * M_PI / 32.0)), (r5 * sin(35 * M_PI / 32.0)));
-            m_256apsk[218] = gr_complex((r5 * cos(39 * M_PI / 32.0)), (r5 * sin(39 * M_PI / 32.0)));
-            m_256apsk[219] = gr_complex((r5 * cos(37 * M_PI / 32.0)), (r5 * sin(37 * M_PI / 32.0)));
-            m_256apsk[220] = gr_complex((r5 * cos(47 * M_PI / 32.0)), (r5 * sin(47 * M_PI / 32.0)));
-            m_256apsk[221] = gr_complex((r5 * cos(45 * M_PI / 32.0)), (r5 * sin(45 * M_PI / 32.0)));
-            m_256apsk[222] = gr_complex((r5 * cos(41 * M_PI / 32.0)), (r5 * sin(41 * M_PI / 32.0)));
-            m_256apsk[223] = gr_complex((r5 * cos(43 * M_PI / 32.0)), (r5 * sin(43 * M_PI / 32.0)));
-            m_256apsk[224] = gr_complex((r6 * cos(M_PI / 32.0)), (r6 * sin(M_PI / 32.0)));
-            m_256apsk[225] = gr_complex((r6 * cos(3 * M_PI / 32.0)), (r6 * sin(3 * M_PI / 32.0)));
-            m_256apsk[226] = gr_complex((r6 * cos(7 * M_PI / 32.0)), (r6 * sin(7 * M_PI / 32.0)));
-            m_256apsk[227] = gr_complex((r6 * cos(5 * M_PI / 32.0)), (r6 * sin(5 * M_PI / 32.0)));
-            m_256apsk[228] = gr_complex((r6 * cos(15 * M_PI / 32.0)), (r6 * sin(15 * M_PI / 32.0)));
-            m_256apsk[229] = gr_complex((r6 * cos(13 * M_PI / 32.0)), (r6 * sin(13 * M_PI / 32.0)));
-            m_256apsk[230] = gr_complex((r6 * cos(9 * M_PI / 32.0)), (r6 * sin(9 * M_PI / 32.0)));
-            m_256apsk[231] = gr_complex((r6 * cos(11 * M_PI / 32.0)), (r6 * sin(11 * M_PI / 32.0)));
-            m_256apsk[232] = gr_complex((r6 * cos(31 * M_PI / 32.0)), (r6 * sin(31 * M_PI / 32.0)));
-            m_256apsk[233] = gr_complex((r6 * cos(29 * M_PI / 32.0)), (r6 * sin(29 * M_PI / 32.0)));
-            m_256apsk[234] = gr_complex((r6 * cos(25 * M_PI / 32.0)), (r6 * sin(25 * M_PI / 32.0)));
-            m_256apsk[235] = gr_complex((r6 * cos(27 * M_PI / 32.0)), (r6 * sin(27 * M_PI / 32.0)));
-            m_256apsk[236] = gr_complex((r6 * cos(17 * M_PI / 32.0)), (r6 * sin(17 * M_PI / 32.0)));
-            m_256apsk[237] = gr_complex((r6 * cos(19 * M_PI / 32.0)), (r6 * sin(19 * M_PI / 32.0)));
-            m_256apsk[238] = gr_complex((r6 * cos(23 * M_PI / 32.0)), (r6 * sin(23 * M_PI / 32.0)));
-            m_256apsk[239] = gr_complex((r6 * cos(21 * M_PI / 32.0)), (r6 * sin(21 * M_PI / 32.0)));
-            m_256apsk[240] = gr_complex((r6 * cos(-1 * M_PI / 32.0)), (r6 * sin(-1 * M_PI / 32.0)));
-            m_256apsk[241] = gr_complex((r6 * cos(-3 * M_PI / 32.0)), (r6 * sin(-3 * M_PI / 32.0)));
-            m_256apsk[242] = gr_complex((r6 * cos(-7 * M_PI / 32.0)), (r6 * sin(-7 * M_PI / 32.0)));
-            m_256apsk[243] = gr_complex((r6 * cos(-5 * M_PI / 32.0)), (r6 * sin(-5 * M_PI / 32.0)));
-            m_256apsk[244] = gr_complex((r6 * cos(-15 * M_PI / 32.0)), (r6 * sin(-15 * M_PI / 32.0)));
-            m_256apsk[245] = gr_complex((r6 * cos(-13 * M_PI / 32.0)), (r6 * sin(-13 * M_PI / 32.0)));
-            m_256apsk[246] = gr_complex((r6 * cos(-9 * M_PI / 32.0)), (r6 * sin(-9 * M_PI / 32.0)));
-            m_256apsk[247] = gr_complex((r6 * cos(-11 * M_PI / 32.0)), (r6 * sin(-11 * M_PI / 32.0)));
-            m_256apsk[248] = gr_complex((r6 * cos(33 * M_PI / 32.0)), (r6 * sin(33 * M_PI / 32.0)));
-            m_256apsk[249] = gr_complex((r6 * cos(35 * M_PI / 32.0)), (r6 * sin(35 * M_PI / 32.0)));
-            m_256apsk[250] = gr_complex((r6 * cos(39 * M_PI / 32.0)), (r6 * sin(39 * M_PI / 32.0)));
-            m_256apsk[251] = gr_complex((r6 * cos(37 * M_PI / 32.0)), (r6 * sin(37 * M_PI / 32.0)));
-            m_256apsk[252] = gr_complex((r6 * cos(47 * M_PI / 32.0)), (r6 * sin(47 * M_PI / 32.0)));
-            m_256apsk[253] = gr_complex((r6 * cos(45 * M_PI / 32.0)), (r6 * sin(45 * M_PI / 32.0)));
-            m_256apsk[254] = gr_complex((r6 * cos(41 * M_PI / 32.0)), (r6 * sin(41 * M_PI / 32.0)));
-            m_256apsk[255] = gr_complex((r6 * cos(43 * M_PI / 32.0)), (r6 * sin(43 * M_PI / 32.0)));
+            m_256apsk[0] = gr_complex((r1 * cos(GR_M_PI / 32.0)), (r1 * sin(GR_M_PI / 32.0)));
+            m_256apsk[1] = gr_complex((r1 * cos(3 * GR_M_PI / 32.0)), (r1 * sin(3 * GR_M_PI / 32.0)));
+            m_256apsk[2] = gr_complex((r1 * cos(7 * GR_M_PI / 32.0)), (r1 * sin(7 * GR_M_PI / 32.0)));
+            m_256apsk[3] = gr_complex((r1 * cos(5 * GR_M_PI / 32.0)), (r1 * sin(5 * GR_M_PI / 32.0)));
+            m_256apsk[4] = gr_complex((r1 * cos(15 * GR_M_PI / 32.0)), (r1 * sin(15 * GR_M_PI / 32.0)));
+            m_256apsk[5] = gr_complex((r1 * cos(13 * GR_M_PI / 32.0)), (r1 * sin(13 * GR_M_PI / 32.0)));
+            m_256apsk[6] = gr_complex((r1 * cos(9 * GR_M_PI / 32.0)), (r1 * sin(9 * GR_M_PI / 32.0)));
+            m_256apsk[7] = gr_complex((r1 * cos(11 * GR_M_PI / 32.0)), (r1 * sin(11 * GR_M_PI / 32.0)));
+            m_256apsk[8] = gr_complex((r1 * cos(31 * GR_M_PI / 32.0)), (r1 * sin(31 * GR_M_PI / 32.0)));
+            m_256apsk[9] = gr_complex((r1 * cos(29 * GR_M_PI / 32.0)), (r1 * sin(29 * GR_M_PI / 32.0)));
+            m_256apsk[10] = gr_complex((r1 * cos(25 * GR_M_PI / 32.0)), (r1 * sin(25 * GR_M_PI / 32.0)));
+            m_256apsk[11] = gr_complex((r1 * cos(27 * GR_M_PI / 32.0)), (r1 * sin(27 * GR_M_PI / 32.0)));
+            m_256apsk[12] = gr_complex((r1 * cos(17 * GR_M_PI / 32.0)), (r1 * sin(17 * GR_M_PI / 32.0)));
+            m_256apsk[13] = gr_complex((r1 * cos(19 * GR_M_PI / 32.0)), (r1 * sin(19 * GR_M_PI / 32.0)));
+            m_256apsk[14] = gr_complex((r1 * cos(23 * GR_M_PI / 32.0)), (r1 * sin(23 * GR_M_PI / 32.0)));
+            m_256apsk[15] = gr_complex((r1 * cos(21 * GR_M_PI / 32.0)), (r1 * sin(21 * GR_M_PI / 32.0)));
+            m_256apsk[16] = gr_complex((r1 * cos(-1 * GR_M_PI / 32.0)), (r1 * sin(-1 * GR_M_PI / 32.0)));
+            m_256apsk[17] = gr_complex((r1 * cos(-3 * GR_M_PI / 32.0)), (r1 * sin(-3 * GR_M_PI / 32.0)));
+            m_256apsk[18] = gr_complex((r1 * cos(-7 * GR_M_PI / 32.0)), (r1 * sin(-7 * GR_M_PI / 32.0)));
+            m_256apsk[19] = gr_complex((r1 * cos(-5 * GR_M_PI / 32.0)), (r1 * sin(-5 * GR_M_PI / 32.0)));
+            m_256apsk[20] = gr_complex((r1 * cos(-15 * GR_M_PI / 32.0)), (r1 * sin(-15 * GR_M_PI / 32.0)));
+            m_256apsk[21] = gr_complex((r1 * cos(-13 * GR_M_PI / 32.0)), (r1 * sin(-13 * GR_M_PI / 32.0)));
+            m_256apsk[22] = gr_complex((r1 * cos(-9 * GR_M_PI / 32.0)), (r1 * sin(-9 * GR_M_PI / 32.0)));
+            m_256apsk[23] = gr_complex((r1 * cos(-11 * GR_M_PI / 32.0)), (r1 * sin(-11 * GR_M_PI / 32.0)));
+            m_256apsk[24] = gr_complex((r1 * cos(33 * GR_M_PI / 32.0)), (r1 * sin(33 * GR_M_PI / 32.0)));
+            m_256apsk[25] = gr_complex((r1 * cos(35 * GR_M_PI / 32.0)), (r1 * sin(35 * GR_M_PI / 32.0)));
+            m_256apsk[26] = gr_complex((r1 * cos(39 * GR_M_PI / 32.0)), (r1 * sin(39 * GR_M_PI / 32.0)));
+            m_256apsk[27] = gr_complex((r1 * cos(37 * GR_M_PI / 32.0)), (r1 * sin(37 * GR_M_PI / 32.0)));
+            m_256apsk[28] = gr_complex((r1 * cos(47 * GR_M_PI / 32.0)), (r1 * sin(47 * GR_M_PI / 32.0)));
+            m_256apsk[29] = gr_complex((r1 * cos(45 * GR_M_PI / 32.0)), (r1 * sin(45 * GR_M_PI / 32.0)));
+            m_256apsk[30] = gr_complex((r1 * cos(41 * GR_M_PI / 32.0)), (r1 * sin(41 * GR_M_PI / 32.0)));
+            m_256apsk[31] = gr_complex((r1 * cos(43 * GR_M_PI / 32.0)), (r1 * sin(43 * GR_M_PI / 32.0)));
+            m_256apsk[32] = gr_complex((r2 * cos(GR_M_PI / 32.0)), (r2 * sin(GR_M_PI / 32.0)));
+            m_256apsk[33] = gr_complex((r2 * cos(3 * GR_M_PI / 32.0)), (r2 * sin(3 * GR_M_PI / 32.0)));
+            m_256apsk[34] = gr_complex((r2 * cos(7 * GR_M_PI / 32.0)), (r2 * sin(7 * GR_M_PI / 32.0)));
+            m_256apsk[35] = gr_complex((r2 * cos(5 * GR_M_PI / 32.0)), (r2 * sin(5 * GR_M_PI / 32.0)));
+            m_256apsk[36] = gr_complex((r2 * cos(15 * GR_M_PI / 32.0)), (r2 * sin(15 * GR_M_PI / 32.0)));
+            m_256apsk[37] = gr_complex((r2 * cos(13 * GR_M_PI / 32.0)), (r2 * sin(13 * GR_M_PI / 32.0)));
+            m_256apsk[38] = gr_complex((r2 * cos(9 * GR_M_PI / 32.0)), (r2 * sin(9 * GR_M_PI / 32.0)));
+            m_256apsk[39] = gr_complex((r2 * cos(11 * GR_M_PI / 32.0)), (r2 * sin(11 * GR_M_PI / 32.0)));
+            m_256apsk[40] = gr_complex((r2 * cos(31 * GR_M_PI / 32.0)), (r2 * sin(31 * GR_M_PI / 32.0)));
+            m_256apsk[41] = gr_complex((r2 * cos(29 * GR_M_PI / 32.0)), (r2 * sin(29 * GR_M_PI / 32.0)));
+            m_256apsk[42] = gr_complex((r2 * cos(25 * GR_M_PI / 32.0)), (r2 * sin(25 * GR_M_PI / 32.0)));
+            m_256apsk[43] = gr_complex((r2 * cos(27 * GR_M_PI / 32.0)), (r2 * sin(27 * GR_M_PI / 32.0)));
+            m_256apsk[44] = gr_complex((r2 * cos(17 * GR_M_PI / 32.0)), (r2 * sin(17 * GR_M_PI / 32.0)));
+            m_256apsk[45] = gr_complex((r2 * cos(19 * GR_M_PI / 32.0)), (r2 * sin(19 * GR_M_PI / 32.0)));
+            m_256apsk[46] = gr_complex((r2 * cos(23 * GR_M_PI / 32.0)), (r2 * sin(23 * GR_M_PI / 32.0)));
+            m_256apsk[47] = gr_complex((r2 * cos(21 * GR_M_PI / 32.0)), (r2 * sin(21 * GR_M_PI / 32.0)));
+            m_256apsk[48] = gr_complex((r2 * cos(-1 * GR_M_PI / 32.0)), (r2 * sin(-1 * GR_M_PI / 32.0)));
+            m_256apsk[49] = gr_complex((r2 * cos(-3 * GR_M_PI / 32.0)), (r2 * sin(-3 * GR_M_PI / 32.0)));
+            m_256apsk[50] = gr_complex((r2 * cos(-7 * GR_M_PI / 32.0)), (r2 * sin(-7 * GR_M_PI / 32.0)));
+            m_256apsk[51] = gr_complex((r2 * cos(-5 * GR_M_PI / 32.0)), (r2 * sin(-5 * GR_M_PI / 32.0)));
+            m_256apsk[52] = gr_complex((r2 * cos(-15 * GR_M_PI / 32.0)), (r2 * sin(-15 * GR_M_PI / 32.0)));
+            m_256apsk[53] = gr_complex((r2 * cos(-13 * GR_M_PI / 32.0)), (r2 * sin(-13 * GR_M_PI / 32.0)));
+            m_256apsk[54] = gr_complex((r2 * cos(-9 * GR_M_PI / 32.0)), (r2 * sin(-9 * GR_M_PI / 32.0)));
+            m_256apsk[55] = gr_complex((r2 * cos(-11 * GR_M_PI / 32.0)), (r2 * sin(-11 * GR_M_PI / 32.0)));
+            m_256apsk[56] = gr_complex((r2 * cos(33 * GR_M_PI / 32.0)), (r2 * sin(33 * GR_M_PI / 32.0)));
+            m_256apsk[57] = gr_complex((r2 * cos(35 * GR_M_PI / 32.0)), (r2 * sin(35 * GR_M_PI / 32.0)));
+            m_256apsk[58] = gr_complex((r2 * cos(39 * GR_M_PI / 32.0)), (r2 * sin(39 * GR_M_PI / 32.0)));
+            m_256apsk[59] = gr_complex((r2 * cos(37 * GR_M_PI / 32.0)), (r2 * sin(37 * GR_M_PI / 32.0)));
+            m_256apsk[60] = gr_complex((r2 * cos(47 * GR_M_PI / 32.0)), (r2 * sin(47 * GR_M_PI / 32.0)));
+            m_256apsk[61] = gr_complex((r2 * cos(45 * GR_M_PI / 32.0)), (r2 * sin(45 * GR_M_PI / 32.0)));
+            m_256apsk[62] = gr_complex((r2 * cos(41 * GR_M_PI / 32.0)), (r2 * sin(41 * GR_M_PI / 32.0)));
+            m_256apsk[63] = gr_complex((r2 * cos(43 * GR_M_PI / 32.0)), (r2 * sin(43 * GR_M_PI / 32.0)));
+            m_256apsk[64] = gr_complex((r4 * cos(GR_M_PI / 32.0)), (r4 * sin(GR_M_PI / 32.0)));
+            m_256apsk[65] = gr_complex((r4 * cos(3 * GR_M_PI / 32.0)), (r4 * sin(3 * GR_M_PI / 32.0)));
+            m_256apsk[66] = gr_complex((r4 * cos(7 * GR_M_PI / 32.0)), (r4 * sin(7 * GR_M_PI / 32.0)));
+            m_256apsk[67] = gr_complex((r4 * cos(5 * GR_M_PI / 32.0)), (r4 * sin(5 * GR_M_PI / 32.0)));
+            m_256apsk[68] = gr_complex((r4 * cos(15 * GR_M_PI / 32.0)), (r4 * sin(15 * GR_M_PI / 32.0)));
+            m_256apsk[69] = gr_complex((r4 * cos(13 * GR_M_PI / 32.0)), (r4 * sin(13 * GR_M_PI / 32.0)));
+            m_256apsk[70] = gr_complex((r4 * cos(9 * GR_M_PI / 32.0)), (r4 * sin(9 * GR_M_PI / 32.0)));
+            m_256apsk[71] = gr_complex((r4 * cos(11 * GR_M_PI / 32.0)), (r4 * sin(11 * GR_M_PI / 32.0)));
+            m_256apsk[72] = gr_complex((r4 * cos(31 * GR_M_PI / 32.0)), (r4 * sin(31 * GR_M_PI / 32.0)));
+            m_256apsk[73] = gr_complex((r4 * cos(29 * GR_M_PI / 32.0)), (r4 * sin(29 * GR_M_PI / 32.0)));
+            m_256apsk[74] = gr_complex((r4 * cos(25 * GR_M_PI / 32.0)), (r4 * sin(25 * GR_M_PI / 32.0)));
+            m_256apsk[75] = gr_complex((r4 * cos(27 * GR_M_PI / 32.0)), (r4 * sin(27 * GR_M_PI / 32.0)));
+            m_256apsk[76] = gr_complex((r4 * cos(17 * GR_M_PI / 32.0)), (r4 * sin(17 * GR_M_PI / 32.0)));
+            m_256apsk[77] = gr_complex((r4 * cos(19 * GR_M_PI / 32.0)), (r4 * sin(19 * GR_M_PI / 32.0)));
+            m_256apsk[78] = gr_complex((r4 * cos(23 * GR_M_PI / 32.0)), (r4 * sin(23 * GR_M_PI / 32.0)));
+            m_256apsk[79] = gr_complex((r4 * cos(21 * GR_M_PI / 32.0)), (r4 * sin(21 * GR_M_PI / 32.0)));
+            m_256apsk[80] = gr_complex((r4 * cos(-1 * GR_M_PI / 32.0)), (r4 * sin(-1 * GR_M_PI / 32.0)));
+            m_256apsk[81] = gr_complex((r4 * cos(-3 * GR_M_PI / 32.0)), (r4 * sin(-3 * GR_M_PI / 32.0)));
+            m_256apsk[82] = gr_complex((r4 * cos(-7 * GR_M_PI / 32.0)), (r4 * sin(-7 * GR_M_PI / 32.0)));
+            m_256apsk[83] = gr_complex((r4 * cos(-5 * GR_M_PI / 32.0)), (r4 * sin(-5 * GR_M_PI / 32.0)));
+            m_256apsk[84] = gr_complex((r4 * cos(-15 * GR_M_PI / 32.0)), (r4 * sin(-15 * GR_M_PI / 32.0)));
+            m_256apsk[85] = gr_complex((r4 * cos(-13 * GR_M_PI / 32.0)), (r4 * sin(-13 * GR_M_PI / 32.0)));
+            m_256apsk[86] = gr_complex((r4 * cos(-9 * GR_M_PI / 32.0)), (r4 * sin(-9 * GR_M_PI / 32.0)));
+            m_256apsk[87] = gr_complex((r4 * cos(-11 * GR_M_PI / 32.0)), (r4 * sin(-11 * GR_M_PI / 32.0)));
+            m_256apsk[88] = gr_complex((r4 * cos(33 * GR_M_PI / 32.0)), (r4 * sin(33 * GR_M_PI / 32.0)));
+            m_256apsk[89] = gr_complex((r4 * cos(35 * GR_M_PI / 32.0)), (r4 * sin(35 * GR_M_PI / 32.0)));
+            m_256apsk[90] = gr_complex((r4 * cos(39 * GR_M_PI / 32.0)), (r4 * sin(39 * GR_M_PI / 32.0)));
+            m_256apsk[91] = gr_complex((r4 * cos(37 * GR_M_PI / 32.0)), (r4 * sin(37 * GR_M_PI / 32.0)));
+            m_256apsk[92] = gr_complex((r4 * cos(47 * GR_M_PI / 32.0)), (r4 * sin(47 * GR_M_PI / 32.0)));
+            m_256apsk[93] = gr_complex((r4 * cos(45 * GR_M_PI / 32.0)), (r4 * sin(45 * GR_M_PI / 32.0)));
+            m_256apsk[94] = gr_complex((r4 * cos(41 * GR_M_PI / 32.0)), (r4 * sin(41 * GR_M_PI / 32.0)));
+            m_256apsk[95] = gr_complex((r4 * cos(43 * GR_M_PI / 32.0)), (r4 * sin(43 * GR_M_PI / 32.0)));
+            m_256apsk[96] = gr_complex((r3 * cos(GR_M_PI / 32.0)), (r3 * sin(GR_M_PI / 32.0)));
+            m_256apsk[97] = gr_complex((r3 * cos(3 * GR_M_PI / 32.0)), (r3 * sin(3 * GR_M_PI / 32.0)));
+            m_256apsk[98] = gr_complex((r3 * cos(7 * GR_M_PI / 32.0)), (r3 * sin(7 * GR_M_PI / 32.0)));
+            m_256apsk[99] = gr_complex((r3 * cos(5 * GR_M_PI / 32.0)), (r3 * sin(5 * GR_M_PI / 32.0)));
+            m_256apsk[100] = gr_complex((r3 * cos(15 * GR_M_PI / 32.0)), (r3 * sin(15 * GR_M_PI / 32.0)));
+            m_256apsk[101] = gr_complex((r3 * cos(13 * GR_M_PI / 32.0)), (r3 * sin(13 * GR_M_PI / 32.0)));
+            m_256apsk[102] = gr_complex((r3 * cos(9 * GR_M_PI / 32.0)), (r3 * sin(9 * GR_M_PI / 32.0)));
+            m_256apsk[103] = gr_complex((r3 * cos(11 * GR_M_PI / 32.0)), (r3 * sin(11 * GR_M_PI / 32.0)));
+            m_256apsk[104] = gr_complex((r3 * cos(31 * GR_M_PI / 32.0)), (r3 * sin(31 * GR_M_PI / 32.0)));
+            m_256apsk[105] = gr_complex((r3 * cos(29 * GR_M_PI / 32.0)), (r3 * sin(29 * GR_M_PI / 32.0)));
+            m_256apsk[106] = gr_complex((r3 * cos(25 * GR_M_PI / 32.0)), (r3 * sin(25 * GR_M_PI / 32.0)));
+            m_256apsk[107] = gr_complex((r3 * cos(27 * GR_M_PI / 32.0)), (r3 * sin(27 * GR_M_PI / 32.0)));
+            m_256apsk[108] = gr_complex((r3 * cos(17 * GR_M_PI / 32.0)), (r3 * sin(17 * GR_M_PI / 32.0)));
+            m_256apsk[109] = gr_complex((r3 * cos(19 * GR_M_PI / 32.0)), (r3 * sin(19 * GR_M_PI / 32.0)));
+            m_256apsk[110] = gr_complex((r3 * cos(23 * GR_M_PI / 32.0)), (r3 * sin(23 * GR_M_PI / 32.0)));
+            m_256apsk[111] = gr_complex((r3 * cos(21 * GR_M_PI / 32.0)), (r3 * sin(21 * GR_M_PI / 32.0)));
+            m_256apsk[112] = gr_complex((r3 * cos(-1 * GR_M_PI / 32.0)), (r3 * sin(-1 * GR_M_PI / 32.0)));
+            m_256apsk[113] = gr_complex((r3 * cos(-3 * GR_M_PI / 32.0)), (r3 * sin(-3 * GR_M_PI / 32.0)));
+            m_256apsk[114] = gr_complex((r3 * cos(-7 * GR_M_PI / 32.0)), (r3 * sin(-7 * GR_M_PI / 32.0)));
+            m_256apsk[115] = gr_complex((r3 * cos(-5 * GR_M_PI / 32.0)), (r3 * sin(-5 * GR_M_PI / 32.0)));
+            m_256apsk[116] = gr_complex((r3 * cos(-15 * GR_M_PI / 32.0)), (r3 * sin(-15 * GR_M_PI / 32.0)));
+            m_256apsk[117] = gr_complex((r3 * cos(-13 * GR_M_PI / 32.0)), (r3 * sin(-13 * GR_M_PI / 32.0)));
+            m_256apsk[118] = gr_complex((r3 * cos(-9 * GR_M_PI / 32.0)), (r3 * sin(-9 * GR_M_PI / 32.0)));
+            m_256apsk[119] = gr_complex((r3 * cos(-11 * GR_M_PI / 32.0)), (r3 * sin(-11 * GR_M_PI / 32.0)));
+            m_256apsk[120] = gr_complex((r3 * cos(33 * GR_M_PI / 32.0)), (r3 * sin(33 * GR_M_PI / 32.0)));
+            m_256apsk[121] = gr_complex((r3 * cos(35 * GR_M_PI / 32.0)), (r3 * sin(35 * GR_M_PI / 32.0)));
+            m_256apsk[122] = gr_complex((r3 * cos(39 * GR_M_PI / 32.0)), (r3 * sin(39 * GR_M_PI / 32.0)));
+            m_256apsk[123] = gr_complex((r3 * cos(37 * GR_M_PI / 32.0)), (r3 * sin(37 * GR_M_PI / 32.0)));
+            m_256apsk[124] = gr_complex((r3 * cos(47 * GR_M_PI / 32.0)), (r3 * sin(47 * GR_M_PI / 32.0)));
+            m_256apsk[125] = gr_complex((r3 * cos(45 * GR_M_PI / 32.0)), (r3 * sin(45 * GR_M_PI / 32.0)));
+            m_256apsk[126] = gr_complex((r3 * cos(41 * GR_M_PI / 32.0)), (r3 * sin(41 * GR_M_PI / 32.0)));
+            m_256apsk[127] = gr_complex((r3 * cos(43 * GR_M_PI / 32.0)), (r3 * sin(43 * GR_M_PI / 32.0)));
+            m_256apsk[128] = gr_complex((r8 * cos(GR_M_PI / 32.0)), (r8 * sin(GR_M_PI / 32.0)));
+            m_256apsk[129] = gr_complex((r8 * cos(3 * GR_M_PI / 32.0)), (r8 * sin(3 * GR_M_PI / 32.0)));
+            m_256apsk[130] = gr_complex((r8 * cos(7 * GR_M_PI / 32.0)), (r8 * sin(7 * GR_M_PI / 32.0)));
+            m_256apsk[131] = gr_complex((r8 * cos(5 * GR_M_PI / 32.0)), (r8 * sin(5 * GR_M_PI / 32.0)));
+            m_256apsk[132] = gr_complex((r8 * cos(15 * GR_M_PI / 32.0)), (r8 * sin(15 * GR_M_PI / 32.0)));
+            m_256apsk[133] = gr_complex((r8 * cos(13 * GR_M_PI / 32.0)), (r8 * sin(13 * GR_M_PI / 32.0)));
+            m_256apsk[134] = gr_complex((r8 * cos(9 * GR_M_PI / 32.0)), (r8 * sin(9 * GR_M_PI / 32.0)));
+            m_256apsk[135] = gr_complex((r8 * cos(11 * GR_M_PI / 32.0)), (r8 * sin(11 * GR_M_PI / 32.0)));
+            m_256apsk[136] = gr_complex((r8 * cos(31 * GR_M_PI / 32.0)), (r8 * sin(31 * GR_M_PI / 32.0)));
+            m_256apsk[137] = gr_complex((r8 * cos(29 * GR_M_PI / 32.0)), (r8 * sin(29 * GR_M_PI / 32.0)));
+            m_256apsk[138] = gr_complex((r8 * cos(25 * GR_M_PI / 32.0)), (r8 * sin(25 * GR_M_PI / 32.0)));
+            m_256apsk[139] = gr_complex((r8 * cos(27 * GR_M_PI / 32.0)), (r8 * sin(27 * GR_M_PI / 32.0)));
+            m_256apsk[140] = gr_complex((r8 * cos(17 * GR_M_PI / 32.0)), (r8 * sin(17 * GR_M_PI / 32.0)));
+            m_256apsk[141] = gr_complex((r8 * cos(19 * GR_M_PI / 32.0)), (r8 * sin(19 * GR_M_PI / 32.0)));
+            m_256apsk[142] = gr_complex((r8 * cos(23 * GR_M_PI / 32.0)), (r8 * sin(23 * GR_M_PI / 32.0)));
+            m_256apsk[143] = gr_complex((r8 * cos(21 * GR_M_PI / 32.0)), (r8 * sin(21 * GR_M_PI / 32.0)));
+            m_256apsk[144] = gr_complex((r8 * cos(-1 * GR_M_PI / 32.0)), (r8 * sin(-1 * GR_M_PI / 32.0)));
+            m_256apsk[145] = gr_complex((r8 * cos(-3 * GR_M_PI / 32.0)), (r8 * sin(-3 * GR_M_PI / 32.0)));
+            m_256apsk[146] = gr_complex((r8 * cos(-7 * GR_M_PI / 32.0)), (r8 * sin(-7 * GR_M_PI / 32.0)));
+            m_256apsk[147] = gr_complex((r8 * cos(-5 * GR_M_PI / 32.0)), (r8 * sin(-5 * GR_M_PI / 32.0)));
+            m_256apsk[148] = gr_complex((r8 * cos(-15 * GR_M_PI / 32.0)), (r8 * sin(-15 * GR_M_PI / 32.0)));
+            m_256apsk[149] = gr_complex((r8 * cos(-13 * GR_M_PI / 32.0)), (r8 * sin(-13 * GR_M_PI / 32.0)));
+            m_256apsk[150] = gr_complex((r8 * cos(-9 * GR_M_PI / 32.0)), (r8 * sin(-9 * GR_M_PI / 32.0)));
+            m_256apsk[151] = gr_complex((r8 * cos(-11 * GR_M_PI / 32.0)), (r8 * sin(-11 * GR_M_PI / 32.0)));
+            m_256apsk[152] = gr_complex((r8 * cos(33 * GR_M_PI / 32.0)), (r8 * sin(33 * GR_M_PI / 32.0)));
+            m_256apsk[153] = gr_complex((r8 * cos(35 * GR_M_PI / 32.0)), (r8 * sin(35 * GR_M_PI / 32.0)));
+            m_256apsk[154] = gr_complex((r8 * cos(39 * GR_M_PI / 32.0)), (r8 * sin(39 * GR_M_PI / 32.0)));
+            m_256apsk[155] = gr_complex((r8 * cos(37 * GR_M_PI / 32.0)), (r8 * sin(37 * GR_M_PI / 32.0)));
+            m_256apsk[156] = gr_complex((r8 * cos(47 * GR_M_PI / 32.0)), (r8 * sin(47 * GR_M_PI / 32.0)));
+            m_256apsk[157] = gr_complex((r8 * cos(45 * GR_M_PI / 32.0)), (r8 * sin(45 * GR_M_PI / 32.0)));
+            m_256apsk[158] = gr_complex((r8 * cos(41 * GR_M_PI / 32.0)), (r8 * sin(41 * GR_M_PI / 32.0)));
+            m_256apsk[159] = gr_complex((r8 * cos(43 * GR_M_PI / 32.0)), (r8 * sin(43 * GR_M_PI / 32.0)));
+            m_256apsk[160] = gr_complex((r7 * cos(GR_M_PI / 32.0)), (r7 * sin(GR_M_PI / 32.0)));
+            m_256apsk[161] = gr_complex((r7 * cos(3 * GR_M_PI / 32.0)), (r7 * sin(3 * GR_M_PI / 32.0)));
+            m_256apsk[162] = gr_complex((r7 * cos(7 * GR_M_PI / 32.0)), (r7 * sin(7 * GR_M_PI / 32.0)));
+            m_256apsk[163] = gr_complex((r7 * cos(5 * GR_M_PI / 32.0)), (r7 * sin(5 * GR_M_PI / 32.0)));
+            m_256apsk[164] = gr_complex((r7 * cos(15 * GR_M_PI / 32.0)), (r7 * sin(15 * GR_M_PI / 32.0)));
+            m_256apsk[165] = gr_complex((r7 * cos(13 * GR_M_PI / 32.0)), (r7 * sin(13 * GR_M_PI / 32.0)));
+            m_256apsk[166] = gr_complex((r7 * cos(9 * GR_M_PI / 32.0)), (r7 * sin(9 * GR_M_PI / 32.0)));
+            m_256apsk[167] = gr_complex((r7 * cos(11 * GR_M_PI / 32.0)), (r7 * sin(11 * GR_M_PI / 32.0)));
+            m_256apsk[168] = gr_complex((r7 * cos(31 * GR_M_PI / 32.0)), (r7 * sin(31 * GR_M_PI / 32.0)));
+            m_256apsk[169] = gr_complex((r7 * cos(29 * GR_M_PI / 32.0)), (r7 * sin(29 * GR_M_PI / 32.0)));
+            m_256apsk[170] = gr_complex((r7 * cos(25 * GR_M_PI / 32.0)), (r7 * sin(25 * GR_M_PI / 32.0)));
+            m_256apsk[171] = gr_complex((r7 * cos(27 * GR_M_PI / 32.0)), (r7 * sin(27 * GR_M_PI / 32.0)));
+            m_256apsk[172] = gr_complex((r7 * cos(17 * GR_M_PI / 32.0)), (r7 * sin(17 * GR_M_PI / 32.0)));
+            m_256apsk[173] = gr_complex((r7 * cos(19 * GR_M_PI / 32.0)), (r7 * sin(19 * GR_M_PI / 32.0)));
+            m_256apsk[174] = gr_complex((r7 * cos(23 * GR_M_PI / 32.0)), (r7 * sin(23 * GR_M_PI / 32.0)));
+            m_256apsk[175] = gr_complex((r7 * cos(21 * GR_M_PI / 32.0)), (r7 * sin(21 * GR_M_PI / 32.0)));
+            m_256apsk[176] = gr_complex((r7 * cos(-1 * GR_M_PI / 32.0)), (r7 * sin(-1 * GR_M_PI / 32.0)));
+            m_256apsk[177] = gr_complex((r7 * cos(-3 * GR_M_PI / 32.0)), (r7 * sin(-3 * GR_M_PI / 32.0)));
+            m_256apsk[178] = gr_complex((r7 * cos(-7 * GR_M_PI / 32.0)), (r7 * sin(-7 * GR_M_PI / 32.0)));
+            m_256apsk[179] = gr_complex((r7 * cos(-5 * GR_M_PI / 32.0)), (r7 * sin(-5 * GR_M_PI / 32.0)));
+            m_256apsk[180] = gr_complex((r7 * cos(-15 * GR_M_PI / 32.0)), (r7 * sin(-15 * GR_M_PI / 32.0)));
+            m_256apsk[181] = gr_complex((r7 * cos(-13 * GR_M_PI / 32.0)), (r7 * sin(-13 * GR_M_PI / 32.0)));
+            m_256apsk[182] = gr_complex((r7 * cos(-9 * GR_M_PI / 32.0)), (r7 * sin(-9 * GR_M_PI / 32.0)));
+            m_256apsk[183] = gr_complex((r7 * cos(-11 * GR_M_PI / 32.0)), (r7 * sin(-11 * GR_M_PI / 32.0)));
+            m_256apsk[184] = gr_complex((r7 * cos(33 * GR_M_PI / 32.0)), (r7 * sin(33 * GR_M_PI / 32.0)));
+            m_256apsk[185] = gr_complex((r7 * cos(35 * GR_M_PI / 32.0)), (r7 * sin(35 * GR_M_PI / 32.0)));
+            m_256apsk[186] = gr_complex((r7 * cos(39 * GR_M_PI / 32.0)), (r7 * sin(39 * GR_M_PI / 32.0)));
+            m_256apsk[187] = gr_complex((r7 * cos(37 * GR_M_PI / 32.0)), (r7 * sin(37 * GR_M_PI / 32.0)));
+            m_256apsk[188] = gr_complex((r7 * cos(47 * GR_M_PI / 32.0)), (r7 * sin(47 * GR_M_PI / 32.0)));
+            m_256apsk[189] = gr_complex((r7 * cos(45 * GR_M_PI / 32.0)), (r7 * sin(45 * GR_M_PI / 32.0)));
+            m_256apsk[190] = gr_complex((r7 * cos(41 * GR_M_PI / 32.0)), (r7 * sin(41 * GR_M_PI / 32.0)));
+            m_256apsk[191] = gr_complex((r7 * cos(43 * GR_M_PI / 32.0)), (r7 * sin(43 * GR_M_PI / 32.0)));
+            m_256apsk[192] = gr_complex((r5 * cos(GR_M_PI / 32.0)), (r5 * sin(GR_M_PI / 32.0)));
+            m_256apsk[193] = gr_complex((r5 * cos(3 * GR_M_PI / 32.0)), (r5 * sin(3 * GR_M_PI / 32.0)));
+            m_256apsk[194] = gr_complex((r5 * cos(7 * GR_M_PI / 32.0)), (r5 * sin(7 * GR_M_PI / 32.0)));
+            m_256apsk[195] = gr_complex((r5 * cos(5 * GR_M_PI / 32.0)), (r5 * sin(5 * GR_M_PI / 32.0)));
+            m_256apsk[196] = gr_complex((r5 * cos(15 * GR_M_PI / 32.0)), (r5 * sin(15 * GR_M_PI / 32.0)));
+            m_256apsk[197] = gr_complex((r5 * cos(13 * GR_M_PI / 32.0)), (r5 * sin(13 * GR_M_PI / 32.0)));
+            m_256apsk[198] = gr_complex((r5 * cos(9 * GR_M_PI / 32.0)), (r5 * sin(9 * GR_M_PI / 32.0)));
+            m_256apsk[199] = gr_complex((r5 * cos(11 * GR_M_PI / 32.0)), (r5 * sin(11 * GR_M_PI / 32.0)));
+            m_256apsk[200] = gr_complex((r5 * cos(31 * GR_M_PI / 32.0)), (r5 * sin(31 * GR_M_PI / 32.0)));
+            m_256apsk[201] = gr_complex((r5 * cos(29 * GR_M_PI / 32.0)), (r5 * sin(29 * GR_M_PI / 32.0)));
+            m_256apsk[202] = gr_complex((r5 * cos(25 * GR_M_PI / 32.0)), (r5 * sin(25 * GR_M_PI / 32.0)));
+            m_256apsk[203] = gr_complex((r5 * cos(27 * GR_M_PI / 32.0)), (r5 * sin(27 * GR_M_PI / 32.0)));
+            m_256apsk[204] = gr_complex((r5 * cos(17 * GR_M_PI / 32.0)), (r5 * sin(17 * GR_M_PI / 32.0)));
+            m_256apsk[205] = gr_complex((r5 * cos(19 * GR_M_PI / 32.0)), (r5 * sin(19 * GR_M_PI / 32.0)));
+            m_256apsk[206] = gr_complex((r5 * cos(23 * GR_M_PI / 32.0)), (r5 * sin(23 * GR_M_PI / 32.0)));
+            m_256apsk[207] = gr_complex((r5 * cos(21 * GR_M_PI / 32.0)), (r5 * sin(21 * GR_M_PI / 32.0)));
+            m_256apsk[208] = gr_complex((r5 * cos(-1 * GR_M_PI / 32.0)), (r5 * sin(-1 * GR_M_PI / 32.0)));
+            m_256apsk[209] = gr_complex((r5 * cos(-3 * GR_M_PI / 32.0)), (r5 * sin(-3 * GR_M_PI / 32.0)));
+            m_256apsk[210] = gr_complex((r5 * cos(-7 * GR_M_PI / 32.0)), (r5 * sin(-7 * GR_M_PI / 32.0)));
+            m_256apsk[211] = gr_complex((r5 * cos(-5 * GR_M_PI / 32.0)), (r5 * sin(-5 * GR_M_PI / 32.0)));
+            m_256apsk[212] = gr_complex((r5 * cos(-15 * GR_M_PI / 32.0)), (r5 * sin(-15 * GR_M_PI / 32.0)));
+            m_256apsk[213] = gr_complex((r5 * cos(-13 * GR_M_PI / 32.0)), (r5 * sin(-13 * GR_M_PI / 32.0)));
+            m_256apsk[214] = gr_complex((r5 * cos(-9 * GR_M_PI / 32.0)), (r5 * sin(-9 * GR_M_PI / 32.0)));
+            m_256apsk[215] = gr_complex((r5 * cos(-11 * GR_M_PI / 32.0)), (r5 * sin(-11 * GR_M_PI / 32.0)));
+            m_256apsk[216] = gr_complex((r5 * cos(33 * GR_M_PI / 32.0)), (r5 * sin(33 * GR_M_PI / 32.0)));
+            m_256apsk[217] = gr_complex((r5 * cos(35 * GR_M_PI / 32.0)), (r5 * sin(35 * GR_M_PI / 32.0)));
+            m_256apsk[218] = gr_complex((r5 * cos(39 * GR_M_PI / 32.0)), (r5 * sin(39 * GR_M_PI / 32.0)));
+            m_256apsk[219] = gr_complex((r5 * cos(37 * GR_M_PI / 32.0)), (r5 * sin(37 * GR_M_PI / 32.0)));
+            m_256apsk[220] = gr_complex((r5 * cos(47 * GR_M_PI / 32.0)), (r5 * sin(47 * GR_M_PI / 32.0)));
+            m_256apsk[221] = gr_complex((r5 * cos(45 * GR_M_PI / 32.0)), (r5 * sin(45 * GR_M_PI / 32.0)));
+            m_256apsk[222] = gr_complex((r5 * cos(41 * GR_M_PI / 32.0)), (r5 * sin(41 * GR_M_PI / 32.0)));
+            m_256apsk[223] = gr_complex((r5 * cos(43 * GR_M_PI / 32.0)), (r5 * sin(43 * GR_M_PI / 32.0)));
+            m_256apsk[224] = gr_complex((r6 * cos(GR_M_PI / 32.0)), (r6 * sin(GR_M_PI / 32.0)));
+            m_256apsk[225] = gr_complex((r6 * cos(3 * GR_M_PI / 32.0)), (r6 * sin(3 * GR_M_PI / 32.0)));
+            m_256apsk[226] = gr_complex((r6 * cos(7 * GR_M_PI / 32.0)), (r6 * sin(7 * GR_M_PI / 32.0)));
+            m_256apsk[227] = gr_complex((r6 * cos(5 * GR_M_PI / 32.0)), (r6 * sin(5 * GR_M_PI / 32.0)));
+            m_256apsk[228] = gr_complex((r6 * cos(15 * GR_M_PI / 32.0)), (r6 * sin(15 * GR_M_PI / 32.0)));
+            m_256apsk[229] = gr_complex((r6 * cos(13 * GR_M_PI / 32.0)), (r6 * sin(13 * GR_M_PI / 32.0)));
+            m_256apsk[230] = gr_complex((r6 * cos(9 * GR_M_PI / 32.0)), (r6 * sin(9 * GR_M_PI / 32.0)));
+            m_256apsk[231] = gr_complex((r6 * cos(11 * GR_M_PI / 32.0)), (r6 * sin(11 * GR_M_PI / 32.0)));
+            m_256apsk[232] = gr_complex((r6 * cos(31 * GR_M_PI / 32.0)), (r6 * sin(31 * GR_M_PI / 32.0)));
+            m_256apsk[233] = gr_complex((r6 * cos(29 * GR_M_PI / 32.0)), (r6 * sin(29 * GR_M_PI / 32.0)));
+            m_256apsk[234] = gr_complex((r6 * cos(25 * GR_M_PI / 32.0)), (r6 * sin(25 * GR_M_PI / 32.0)));
+            m_256apsk[235] = gr_complex((r6 * cos(27 * GR_M_PI / 32.0)), (r6 * sin(27 * GR_M_PI / 32.0)));
+            m_256apsk[236] = gr_complex((r6 * cos(17 * GR_M_PI / 32.0)), (r6 * sin(17 * GR_M_PI / 32.0)));
+            m_256apsk[237] = gr_complex((r6 * cos(19 * GR_M_PI / 32.0)), (r6 * sin(19 * GR_M_PI / 32.0)));
+            m_256apsk[238] = gr_complex((r6 * cos(23 * GR_M_PI / 32.0)), (r6 * sin(23 * GR_M_PI / 32.0)));
+            m_256apsk[239] = gr_complex((r6 * cos(21 * GR_M_PI / 32.0)), (r6 * sin(21 * GR_M_PI / 32.0)));
+            m_256apsk[240] = gr_complex((r6 * cos(-1 * GR_M_PI / 32.0)), (r6 * sin(-1 * GR_M_PI / 32.0)));
+            m_256apsk[241] = gr_complex((r6 * cos(-3 * GR_M_PI / 32.0)), (r6 * sin(-3 * GR_M_PI / 32.0)));
+            m_256apsk[242] = gr_complex((r6 * cos(-7 * GR_M_PI / 32.0)), (r6 * sin(-7 * GR_M_PI / 32.0)));
+            m_256apsk[243] = gr_complex((r6 * cos(-5 * GR_M_PI / 32.0)), (r6 * sin(-5 * GR_M_PI / 32.0)));
+            m_256apsk[244] = gr_complex((r6 * cos(-15 * GR_M_PI / 32.0)), (r6 * sin(-15 * GR_M_PI / 32.0)));
+            m_256apsk[245] = gr_complex((r6 * cos(-13 * GR_M_PI / 32.0)), (r6 * sin(-13 * GR_M_PI / 32.0)));
+            m_256apsk[246] = gr_complex((r6 * cos(-9 * GR_M_PI / 32.0)), (r6 * sin(-9 * GR_M_PI / 32.0)));
+            m_256apsk[247] = gr_complex((r6 * cos(-11 * GR_M_PI / 32.0)), (r6 * sin(-11 * GR_M_PI / 32.0)));
+            m_256apsk[248] = gr_complex((r6 * cos(33 * GR_M_PI / 32.0)), (r6 * sin(33 * GR_M_PI / 32.0)));
+            m_256apsk[249] = gr_complex((r6 * cos(35 * GR_M_PI / 32.0)), (r6 * sin(35 * GR_M_PI / 32.0)));
+            m_256apsk[250] = gr_complex((r6 * cos(39 * GR_M_PI / 32.0)), (r6 * sin(39 * GR_M_PI / 32.0)));
+            m_256apsk[251] = gr_complex((r6 * cos(37 * GR_M_PI / 32.0)), (r6 * sin(37 * GR_M_PI / 32.0)));
+            m_256apsk[252] = gr_complex((r6 * cos(47 * GR_M_PI / 32.0)), (r6 * sin(47 * GR_M_PI / 32.0)));
+            m_256apsk[253] = gr_complex((r6 * cos(45 * GR_M_PI / 32.0)), (r6 * sin(45 * GR_M_PI / 32.0)));
+            m_256apsk[254] = gr_complex((r6 * cos(41 * GR_M_PI / 32.0)), (r6 * sin(41 * GR_M_PI / 32.0)));
+            m_256apsk[255] = gr_complex((r6 * cos(43 * GR_M_PI / 32.0)), (r6 * sin(43 * GR_M_PI / 32.0)));
           }
           break;
         case MOD_64QAM:
@@ -1990,10 +1991,10 @@ namespace gr {
           m_8psk[7] = gr_complex( 7.0 + 1.25, 0.0);
           break;
         default:
-          m_qpsk[0] = gr_complex((r1 * cos(M_PI / 4.0)), (r1 * sin(M_PI / 4.0)));
-          m_qpsk[1] = gr_complex((r1 * cos(7 * M_PI / 4.0)), (r1 * sin(7 * M_PI / 4.0)));
-          m_qpsk[2] = gr_complex((r1 * cos(3 * M_PI / 4.0)), (r1 * sin(3 * M_PI / 4.0)));
-          m_qpsk[3] = gr_complex((r1 * cos(5 * M_PI / 4.0)), (r1 * sin(5 * M_PI / 4.0)));
+          m_qpsk[0] = gr_complex((r1 * cos(GR_M_PI / 4.0)), (r1 * sin(GR_M_PI / 4.0)));
+          m_qpsk[1] = gr_complex((r1 * cos(7 * GR_M_PI / 4.0)), (r1 * sin(7 * GR_M_PI / 4.0)));
+          m_qpsk[2] = gr_complex((r1 * cos(3 * GR_M_PI / 4.0)), (r1 * sin(3 * GR_M_PI / 4.0)));
+          m_qpsk[3] = gr_complex((r1 * cos(5 * GR_M_PI / 4.0)), (r1 * sin(5 * GR_M_PI / 4.0)));
           break;
       }
       signal_constellation = constellation;
diff --git a/gr-dtv/lib/dvbs2/dvbs2_physical_cc_impl.cc b/gr-dtv/lib/dvbs2/dvbs2_physical_cc_impl.cc
index 5da18b1d21..b441cdc10d 100644
--- a/gr-dtv/lib/dvbs2/dvbs2_physical_cc_impl.cc
+++ b/gr-dtv/lib/dvbs2/dvbs2_physical_cc_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /* 
- * Copyright 2015,2016 Free Software Foundation, Inc.
+ * Copyright 2015,2016,2018 Free Software Foundation, Inc.
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,8 +22,9 @@
 #include "config.h"
 #endif
 
-#include <gnuradio/io_signature.h>
 #include "dvbs2_physical_cc_impl.h"
+#include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
 
 namespace gr {
   namespace dtv {
@@ -129,14 +130,14 @@ namespace gr {
           break;
       }
 
-      m_bpsk[0][0] = gr_complex((r0 * cos(M_PI / 4.0)), (r0 * sin(M_PI / 4.0)));
-      m_bpsk[0][1] = gr_complex((r0 * cos(5.0 * M_PI / 4.0)), (r0 * sin(5.0 * M_PI / 4.0)));
-      m_bpsk[1][0] = gr_complex((r0 * cos(5.0 * M_PI / 4.0)), (r0 * sin(M_PI / 4.0)));
-      m_bpsk[1][1] = gr_complex((r0 * cos(M_PI / 4.0)), (r0 * sin(5.0 * M_PI /4.0)));
-      m_bpsk[2][0] = gr_complex((r0 * cos(5.0 * M_PI / 4.0)), (r0 * sin(M_PI / 4.0)));
-      m_bpsk[2][1] = gr_complex((r0 * cos(M_PI / 4.0)), (r0 * sin(5.0 * M_PI /4.0)));
-      m_bpsk[3][0] = gr_complex((r0 * cos(5.0 * M_PI / 4.0)), (r0 * sin(5.0 * M_PI / 4.0)));
-      m_bpsk[3][1] = gr_complex((r0 * cos(M_PI / 4.0)), (r0 * sin(M_PI / 4.0)));
+      m_bpsk[0][0] = gr_complex((r0 * cos(GR_M_PI / 4.0)), (r0 * sin(GR_M_PI / 4.0)));
+      m_bpsk[0][1] = gr_complex((r0 * cos(5.0 * GR_M_PI / 4.0)), (r0 * sin(5.0 * GR_M_PI / 4.0)));
+      m_bpsk[1][0] = gr_complex((r0 * cos(5.0 * GR_M_PI / 4.0)), (r0 * sin(GR_M_PI / 4.0)));
+      m_bpsk[1][1] = gr_complex((r0 * cos(GR_M_PI / 4.0)), (r0 * sin(5.0 * GR_M_PI /4.0)));
+      m_bpsk[2][0] = gr_complex((r0 * cos(5.0 * GR_M_PI / 4.0)), (r0 * sin(GR_M_PI / 4.0)));
+      m_bpsk[2][1] = gr_complex((r0 * cos(GR_M_PI / 4.0)), (r0 * sin(5.0 * GR_M_PI /4.0)));
+      m_bpsk[3][0] = gr_complex((r0 * cos(5.0 * GR_M_PI / 4.0)), (r0 * sin(5.0 * GR_M_PI / 4.0)));
+      m_bpsk[3][1] = gr_complex((r0 * cos(GR_M_PI / 4.0)), (r0 * sin(GR_M_PI / 4.0)));
 
       m_zero = gr_complex(0.0, 0.0);
 
diff --git a/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc b/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc
index 1a347d3d8d..079d948163 100644
--- a/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc
+++ b/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2015,2016 Free Software Foundation, Inc.
+ * Copyright 2015,2016,2018 Free Software Foundation, Inc.
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,13 +22,13 @@
 #include "config.h"
 #endif
 
-#include <gnuradio/io_signature.h>
 #include "dvbt_ofdm_sym_acquisition_impl.h"
-#include <complex>
-#include <limits>
+#include <gnuradio/io_signature.h>
 #include <gnuradio/math.h>
 #include <gnuradio/expj.h>
 #include <volk/volk.h>
+#include <complex>
+#include <limits>
 
 namespace gr {
   namespace dtv {
@@ -170,11 +170,11 @@ namespace gr {
           // We are interested only in fft_length
           d_phase += d_phaseinc;
 
-          while (d_phase > (float)M_PI) {
-            d_phase -= (float)(2.0 * M_PI);
+          while (d_phase > (float)GR_M_PI) {
+            d_phase -= (float)(2.0 * GR_M_PI);
           }
-          while (d_phase < (float)(-M_PI)) {
-            d_phase += (float)(2.0 * M_PI);
+          while (d_phase < (float)(-GR_M_PI)) {
+            d_phase += (float)(2.0 * GR_M_PI);
           }
 
           derot[i] = gr_expj(d_phase);
@@ -190,11 +190,11 @@ namespace gr {
         for (int i = 0; i < (d_cp_length + d_fft_length); i++) {
           d_phase += d_phaseinc;
 
-          while (d_phase > (float)M_PI) {
-            d_phase -= (float)(2.0 * M_PI);
+          while (d_phase > (float)GR_M_PI) {
+            d_phase -= (float)(2.0 * GR_M_PI);
           }
-          while (d_phase < (float)(-M_PI)) {
-            d_phase += (float)(2.0 * M_PI);
+          while (d_phase < (float)(-GR_M_PI)) {
+            d_phase += (float)(2.0 * GR_M_PI);
           }
         }
 
diff --git a/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc b/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc
index c4d85e65ed..c82c4ebd2b 100644
--- a/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc
+++ b/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /* 
- * Copyright 2015,2016 Free Software Foundation, Inc.
+ * Copyright 2015,2016,2018 Free Software Foundation, Inc.
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,11 +22,11 @@
 #include "config.h"
 #endif
 
-#include <gnuradio/io_signature.h>
 #include "dvbt_reference_signals_impl.h"
-#include <complex>
+#include <gnuradio/io_signature.h>
 #include <gnuradio/expj.h>
 #include <gnuradio/math.h>
+#include <complex>
 
 namespace gr {
   namespace dtv {
@@ -725,8 +725,8 @@ namespace gr {
       int half_size = (d_cpilot_carriers_size - 1) / 2;
 
       // TODO init this in constructor
-      float carrier_coeff = 1.0 / (2 * M_PI * (1 + float (d_cp_length) / float (d_fft_length)) * 2);
-      float sampling_coeff = 1.0 / (2 * M_PI * ((1 + float (d_cp_length) / float (d_fft_length)) * ((float)d_cpilot_carriers_size / 2.0)));
+      float carrier_coeff = 1.0 / (2 * GR_M_PI * (1 + float (d_cp_length) / float (d_fft_length)) * 2);
+      float sampling_coeff = 1.0 / (2 * GR_M_PI * ((1 + float (d_cp_length) / float (d_fft_length)) * ((float)d_cpilot_carriers_size / 2.0)));
 
       float left_angle, right_angle;
 
@@ -764,7 +764,7 @@ namespace gr {
 
         float correction = (float)d_freq_offset + d_carrier_freq_correction;
 
-        gr_complex c = gr_expj(-2 * M_PI * correction * \
+        gr_complex c = gr_expj(-2 * GR_M_PI * correction * \
           (d_fft_length + d_cp_length) / d_fft_length * symbol_count);
 
         // TODO - vectorize this operation
diff --git a/gr-dtv/lib/dvbt2/dvbt2_modulator_bc_impl.cc b/gr-dtv/lib/dvbt2/dvbt2_modulator_bc_impl.cc
index 05e3382ef9..7435c4ad36 100644
--- a/gr-dtv/lib/dvbt2/dvbt2_modulator_bc_impl.cc
+++ b/gr-dtv/lib/dvbt2/dvbt2_modulator_bc_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /* 
- * Copyright 2015,2017 Free Software Foundation, Inc.
+ * Copyright 2015,2017,2018 Free Software Foundation, Inc.
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,8 +22,9 @@
 #include "config.h"
 #endif
 
-#include <gnuradio/io_signature.h>
 #include "dvbt2_modulator_bc_impl.h"
+#include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
 
 namespace gr {
   namespace dtv {
@@ -98,7 +99,7 @@ namespace gr {
           m_qpsk[3] = gr_complex(-1.0 / normalization, -1.0 / normalization);
           if (rotation == ROTATION_ON) {
             cyclic_delay = TRUE;
-            rotation_angle = (2.0 * M_PI * 29.0) / 360.0;
+            rotation_angle = (2.0 * GR_M_PI * 29.0) / 360.0;
             temp = std::exp(gr_complexd(0.0, rotation_angle));
             for (int i = 0; i < 4; i++) {
               m_qpsk[i] *= temp;
@@ -114,7 +115,7 @@ namespace gr {
           }
           if (rotation == ROTATION_ON) {
             cyclic_delay = TRUE;
-            rotation_angle = (2.0 * M_PI * 16.8) / 360.0;
+            rotation_angle = (2.0 * GR_M_PI * 16.8) / 360.0;
             temp = std::exp(gr_complexd(0.0, rotation_angle));
             for (int i = 0; i < 16; i++) {
               m_16qam[i] *= temp;
@@ -130,7 +131,7 @@ namespace gr {
           }
           if (rotation == ROTATION_ON) {
             cyclic_delay = TRUE;
-            rotation_angle = (2.0 * M_PI * 8.6) / 360.0;
+            rotation_angle = (2.0 * GR_M_PI * 8.6) / 360.0;
             temp = std::exp(gr_complexd(0.0, rotation_angle));
             for (int i = 0; i < 64; i++) {
               m_64qam[i] *= temp;
@@ -146,7 +147,7 @@ namespace gr {
           }
           if (rotation == ROTATION_ON) {
             cyclic_delay = TRUE;
-            rotation_angle = (2.0 * M_PI * 3.576334375) / 360.0;
+            rotation_angle = (2.0 * GR_M_PI * 3.576334375) / 360.0;
             temp = std::exp(gr_complexd(0.0, rotation_angle));
             for (int i = 0; i < 256; i++) {
               m_256qam[i] *= temp;
@@ -161,7 +162,7 @@ namespace gr {
           m_qpsk[3] = gr_complex(-1.0 / normalization, -1.0 / normalization);
           if (rotation == ROTATION_ON) {
             cyclic_delay = TRUE;
-            rotation_angle = (2.0 * M_PI * 29.0) / 360.0;
+            rotation_angle = (2.0 * GR_M_PI * 29.0) / 360.0;
             temp = std::exp(gr_complexd(0.0, rotation_angle));
             for (int i = 0; i < 4; i++) {
               m_qpsk[i] *= temp;
diff --git a/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc b/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc
index a83c56182e..bcdc4c66ac 100644
--- a/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc
+++ b/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /* 
- * Copyright 2015-2017 Free Software Foundation, Inc.
+ * Copyright 2015-2018 Free Software Foundation, Inc.
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,8 +22,9 @@
 #include "config.h"
 #endif
 
-#include <gnuradio/io_signature.h>
 #include "dvbt2_paprtr_cc_impl.h"
+#include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
 #include <volk/volk.h>
 
 /* An early exit from the iteration loop is a very effective optimization */
@@ -774,7 +775,7 @@ namespace gr {
                 u = (in[m] + c[m]) / y;
                 alpha = y - v_clip;
                 for (int n = 0; n < N_TR; n++) {
-                  vtemp = (-2.0 * M_PI * m * ((papr_map[n] + shift) - center)) / papr_fft_size;
+                  vtemp = (-2.0 * GR_M_PI * m * ((papr_map[n] + shift) - center)) / papr_fft_size;
                   ctemp[n] = std::exp(gr_complexd(0.0, vtemp));
                 }
                 volk_32fc_s32fc_multiply_32fc(v, ctemp, u, N_TR);
diff --git a/gr-dtv/lib/dvbt2/dvbt2_pilotgenerator_cc_impl.cc b/gr-dtv/lib/dvbt2/dvbt2_pilotgenerator_cc_impl.cc
index 2bb19f5189..3724533b3d 100644
--- a/gr-dtv/lib/dvbt2/dvbt2_pilotgenerator_cc_impl.cc
+++ b/gr-dtv/lib/dvbt2/dvbt2_pilotgenerator_cc_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /* 
- * Copyright 2015,2016 Free Software Foundation, Inc.
+ * Copyright 2015,2016,2018 Free Software Foundation, Inc.
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,8 +22,9 @@
 #include "config.h"
 #endif
 
-#include <gnuradio/io_signature.h>
 #include "dvbt2_pilotgenerator_cc_impl.h"
+#include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
 #include <volk/volk.h>
 
 namespace gr {
@@ -1113,7 +1114,7 @@ namespace gr {
       }
       fstep = fs / vlength;
       for (int i = 0; i < vlength / 2; i++) {
-        x = M_PI * f / fs;
+        x = GR_M_PI * f / fs;
         if (i == 0) {
           sinc = 1.0;
         }
diff --git a/gr-fft/lib/goertzel.cc b/gr-fft/lib/goertzel.cc
index 14098180b5..324d2a76a2 100644
--- a/gr-fft/lib/goertzel.cc
+++ b/gr-fft/lib/goertzel.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2002,2011,2012 Free Software Foundation, Inc.
+ * Copyright 2002,2011,2012,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -24,8 +24,9 @@
 #include <config.h>
 #endif
 
-#include <cmath>
 #include <gnuradio/fft/goertzel.h>
+#include <gnuradio/math.h>
+#include <cmath>
 
 namespace gr {
   namespace fft {
@@ -41,7 +42,7 @@ namespace gr {
       d_d1 = 0.0;
       d_d2 = 0.0;
 
-      float w = 2.0*M_PI*freq/rate;
+      float w = 2.0*GR_M_PI*freq/rate;
       d_wr = 2.0*std::cos(w);
       d_wi = std::sin(w);
       d_len = len;
diff --git a/gr-fft/lib/window.cc b/gr-fft/lib/window.cc
index cfbdb93dbd..0c1e27f66a 100644
--- a/gr-fft/lib/window.cc
+++ b/gr-fft/lib/window.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2002,2007,2008,2012,2013 Free Software Foundation, Inc.
+ * Copyright 2002,2007,2008,2012,2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -25,6 +25,7 @@
 #endif
 
 #include <gnuradio/fft/window.h>
+#include <gnuradio/math.h>
 #include <stdexcept>
 
 namespace gr {
@@ -66,7 +67,7 @@ namespace gr {
 
     double freq(int ntaps)
     {
-      return 2.0*M_PI/ntaps;
+      return 2.0*GR_M_PI/ntaps;
     }
 
     double rate(int ntaps)
@@ -98,7 +99,7 @@ namespace gr {
       float M = static_cast<float>(ntaps - 1);
 
       for(int n = 0; n < ntaps; n++)
-        taps[n] = c0 - c1*cosf((2.0f*M_PI*n)/M) + c2*cosf((4.0f*M_PI*n)/M);
+        taps[n] = c0 - c1*cosf((2.0f*GR_M_PI*n)/M) + c2*cosf((4.0f*GR_M_PI*n)/M);
       return taps;
     }
 
@@ -109,8 +110,8 @@ namespace gr {
       float M = static_cast<float>(ntaps - 1);
 
       for(int n = 0; n < ntaps; n++)
-        taps[n] = c0 - c1*cosf((2.0f*M_PI*n)/M) + c2*cosf((4.0f*M_PI*n)/M) \
-          - c3*cosf((6.0f*M_PI*n)/M);
+        taps[n] = c0 - c1*cosf((2.0f*GR_M_PI*n)/M) + c2*cosf((4.0f*GR_M_PI*n)/M) \
+          - c3*cosf((6.0f*GR_M_PI*n)/M);
       return taps;
     }
 
@@ -121,8 +122,8 @@ namespace gr {
       float M = static_cast<float>(ntaps - 1);
 
       for(int n = 0; n < ntaps; n++)
-        taps[n] = c0 - c1*cosf((2.0f*M_PI*n)/M) + c2*cosf((4.0f*M_PI*n)/M) \
-          - c3*cosf((6.0f*M_PI*n)/M) + c4*cosf((8.0f*M_PI*n)/M);
+        taps[n] = c0 - c1*cosf((2.0f*GR_M_PI*n)/M) + c2*cosf((4.0f*GR_M_PI*n)/M) \
+          - c3*cosf((6.0f*GR_M_PI*n)/M) + c4*cosf((8.0f*GR_M_PI*n)/M);
       return taps;
     }
 
@@ -142,7 +143,7 @@ namespace gr {
       float M = static_cast<float>(ntaps - 1);
 
       for(int n = 0; n < ntaps; n++)
-        taps[n] = 0.54 - 0.46 * cos((2 * M_PI * n) / M);
+        taps[n] = 0.54 - 0.46 * cos((2 * GR_M_PI * n) / M);
       return taps;
     }
 
@@ -153,7 +154,7 @@ namespace gr {
       float M = static_cast<float>(ntaps - 1);
 
       for(int n = 0; n < ntaps; n++)
-        taps[n] = 0.5 - 0.5 * cos((2 * M_PI * n) / M);
+        taps[n] = 0.5 - 0.5 * cos((2 * GR_M_PI * n) / M);
       return taps;
     }
 
diff --git a/gr-filter/lib/firdes.cc b/gr-filter/lib/firdes.cc
index 323de42509..cd041336f4 100644
--- a/gr-filter/lib/firdes.cc
+++ b/gr-filter/lib/firdes.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2002,2007,2008,2012,2013 Free Software Foundation, Inc.
+ * Copyright 2002,2007,2008,2012,2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -25,6 +25,7 @@
 #endif
 
 #include <gnuradio/filter/firdes.h>
+#include <gnuradio/math.h>
 #include <stdexcept>
 
 using std::vector;
@@ -64,13 +65,13 @@ namespace gr {
       vector<float> w = window(window_type, ntaps, beta);
 
       int M = (ntaps - 1) / 2;
-      double fwT0 = 2 * M_PI * cutoff_freq / sampling_freq;
+      double fwT0 = 2 * GR_M_PI * cutoff_freq / sampling_freq;
       for(int n = -M; n <= M; n++) {
 	if (n == 0)
-	  taps[n + M] = fwT0 / M_PI * w[n + M];
+	  taps[n + M] = fwT0 / GR_M_PI * w[n + M];
 	else {
 	  // a little algebra gets this into the more familiar sin(x)/x form
-	  taps[n + M] =  sin(n * fwT0) / (n * M_PI) * w[n + M];
+	  taps[n + M] =  sin(n * fwT0) / (n * GR_M_PI) * w[n + M];
 	}
       }
 
@@ -110,14 +111,14 @@ namespace gr {
       vector<float> w = window(window_type, ntaps, beta);
 
       int M = (ntaps - 1) / 2;
-      double fwT0 = 2 * M_PI * cutoff_freq / sampling_freq;
+      double fwT0 = 2 * GR_M_PI * cutoff_freq / sampling_freq;
 
       for(int n = -M; n <= M; n++) {
 	if(n == 0)
-	  taps[n + M] = fwT0 / M_PI * w[n + M];
+	  taps[n + M] = fwT0 / GR_M_PI * w[n + M];
 	else {
 	  // a little algebra gets this into the more familiar sin(x)/x form
-	  taps[n + M] =  sin(n * fwT0) / (n * M_PI) * w[n + M];
+	  taps[n + M] =  sin(n * fwT0) / (n * GR_M_PI) * w[n + M];
 	}
       }
 
@@ -162,14 +163,14 @@ namespace gr {
       vector<float> w = window(window_type, ntaps, beta);
 
       int M = (ntaps - 1) / 2;
-      double fwT0 = 2 * M_PI * cutoff_freq / sampling_freq;
+      double fwT0 = 2 * GR_M_PI * cutoff_freq / sampling_freq;
 
       for(int n = -M; n <= M; n++) {
 	if(n == 0)
-	  taps[n + M] = (1 - (fwT0 / M_PI)) * w[n + M];
+	  taps[n + M] = (1 - (fwT0 / GR_M_PI)) * w[n + M];
 	else {
 	  // a little algebra gets this into the more familiar sin(x)/x form
-	  taps[n + M] =  -sin(n * fwT0) / (n * M_PI) * w[n + M];
+	  taps[n + M] =  -sin(n * fwT0) / (n * GR_M_PI) * w[n + M];
 	}
       }
 
@@ -178,7 +179,7 @@ namespace gr {
 
       double fmax = taps[0 + M];
       for(int n = 1; n <= M; n++)
-	fmax += 2 * taps[n + M] * cos(n * M_PI);
+	fmax += 2 * taps[n + M] * cos(n * GR_M_PI);
 
       gain /= fmax; // normalize
 
@@ -209,14 +210,14 @@ namespace gr {
       vector<float> w = window(window_type, ntaps, beta);
 
       int M = (ntaps - 1) / 2;
-      double fwT0 = 2 * M_PI * cutoff_freq / sampling_freq;
+      double fwT0 = 2 * GR_M_PI * cutoff_freq / sampling_freq;
 
       for(int n = -M; n <= M; n++) {
 	if(n == 0)
-	  taps[n + M] = (1 - (fwT0 / M_PI)) * w[n + M];
+	  taps[n + M] = (1 - (fwT0 / GR_M_PI)) * w[n + M];
 	else {
 	  // a little algebra gets this into the more familiar sin(x)/x form
-	  taps[n + M] =  -sin(n * fwT0) / (n * M_PI) * w[n + M];
+	  taps[n + M] =  -sin(n * fwT0) / (n * GR_M_PI) * w[n + M];
 	}
       }
 
@@ -225,7 +226,7 @@ namespace gr {
 
       double fmax = taps[0 + M];
       for(int n = 1; n <= M; n++)
-	fmax += 2 * taps[n + M] * cos(n * M_PI);
+	fmax += 2 * taps[n + M] * cos(n * GR_M_PI);
 
       gain /= fmax; // normalize
 
@@ -261,14 +262,14 @@ namespace gr {
       vector<float> w = window(window_type, ntaps, beta);
 
       int M = (ntaps - 1) / 2;
-      double fwT0 = 2 * M_PI * low_cutoff_freq / sampling_freq;
-      double fwT1 = 2 * M_PI * high_cutoff_freq / sampling_freq;
+      double fwT0 = 2 * GR_M_PI * low_cutoff_freq / sampling_freq;
+      double fwT1 = 2 * GR_M_PI * high_cutoff_freq / sampling_freq;
 
       for(int n = -M; n <= M; n++) {
 	if (n == 0)
-	  taps[n + M] = (fwT1 - fwT0) / M_PI * w[n + M];
+	  taps[n + M] = (fwT1 - fwT0) / GR_M_PI * w[n + M];
 	else {
-	  taps[n + M] =  (sin(n * fwT1) - sin(n * fwT0)) / (n * M_PI) * w[n + M];
+	  taps[n + M] =  (sin(n * fwT1) - sin(n * fwT0)) / (n * GR_M_PI) * w[n + M];
 	}
       }
 
@@ -312,14 +313,14 @@ namespace gr {
       vector<float> w = window(window_type, ntaps, beta);
 
       int M = (ntaps - 1) / 2;
-      double fwT0 = 2 * M_PI * low_cutoff_freq / sampling_freq;
-      double fwT1 = 2 * M_PI * high_cutoff_freq / sampling_freq;
+      double fwT0 = 2 * GR_M_PI * low_cutoff_freq / sampling_freq;
+      double fwT1 = 2 * GR_M_PI * high_cutoff_freq / sampling_freq;
 
       for(int n = -M; n <= M; n++) {
 	if (n == 0)
-	  taps[n + M] = (fwT1 - fwT0) / M_PI * w[n + M];
+	  taps[n + M] = (fwT1 - fwT0) / GR_M_PI * w[n + M];
 	else {
-	  taps[n + M] =  (sin(n * fwT1) - sin(n * fwT0)) / (n * M_PI) * w[n + M];
+	  taps[n + M] =  (sin(n * fwT1) - sin(n * fwT0)) / (n * GR_M_PI) * w[n + M];
 	}
       }
 
@@ -372,7 +373,7 @@ namespace gr {
 
       gr_complex *optr = &taps[0];
       float *iptr = &lptaps[0];
-      float freq = M_PI * (high_cutoff_freq + low_cutoff_freq)/sampling_freq;
+      float freq = GR_M_PI * (high_cutoff_freq + low_cutoff_freq)/sampling_freq;
       float phase = 0;
       if (lptaps.size() & 01) {
 	phase = - freq * ( lptaps.size() >> 1 );
@@ -419,7 +420,7 @@ namespace gr {
 
       gr_complex *optr = &taps[0];
       float *iptr = &lptaps[0];
-      float freq = M_PI * (high_cutoff_freq + low_cutoff_freq)/sampling_freq;
+      float freq = GR_M_PI * (high_cutoff_freq + low_cutoff_freq)/sampling_freq;
       float phase = 0;
       if(lptaps.size() & 01) {
 	phase = - freq * ( lptaps.size() >> 1 );
@@ -464,14 +465,14 @@ namespace gr {
       vector<float> w = window(window_type, ntaps, beta);
 
       int M = (ntaps - 1) / 2;
-      double fwT0 = 2 * M_PI * low_cutoff_freq / sampling_freq;
-      double fwT1 = 2 * M_PI * high_cutoff_freq / sampling_freq;
+      double fwT0 = 2 * GR_M_PI * low_cutoff_freq / sampling_freq;
+      double fwT1 = 2 * GR_M_PI * high_cutoff_freq / sampling_freq;
 
       for(int n = -M; n <= M; n++) {
 	if (n == 0)
-	  taps[n + M] = 1.0 + ((fwT0 - fwT1) / M_PI * w[n + M]);
+	  taps[n + M] = 1.0 + ((fwT0 - fwT1) / GR_M_PI * w[n + M]);
 	else {
-	  taps[n + M] =  (sin(n * fwT0) - sin(n * fwT1)) / (n * M_PI) * w[n + M];
+	  taps[n + M] =  (sin(n * fwT0) - sin(n * fwT1)) / (n * GR_M_PI) * w[n + M];
 	}
       }
 
@@ -514,14 +515,14 @@ namespace gr {
       vector<float> w = window(window_type, ntaps, beta);
 
       int M = (ntaps - 1) / 2;
-      double fwT0 = 2 * M_PI * low_cutoff_freq / sampling_freq;
-      double fwT1 = 2 * M_PI * high_cutoff_freq / sampling_freq;
+      double fwT0 = 2 * GR_M_PI * low_cutoff_freq / sampling_freq;
+      double fwT1 = 2 * GR_M_PI * high_cutoff_freq / sampling_freq;
 
       for(int n = -M; n <= M; n++) {
 	if (n == 0)
-	  taps[n + M] = 1.0 + ((fwT0 - fwT1) / M_PI * w[n + M]);
+	  taps[n + M] = 1.0 + ((fwT0 - fwT1) / GR_M_PI * w[n + M]);
 	else {
-	  taps[n + M] =  (sin(n * fwT0) - sin(n * fwT1)) / (n * M_PI) * w[n + M];
+	  taps[n + M] =  (sin(n * fwT0) - sin(n * fwT1)) / (n * GR_M_PI) * w[n + M];
 	}
       }
 
@@ -586,7 +587,7 @@ namespace gr {
       vector<float> taps(ntaps);
       double scale = 0;
       double dt = 1.0/spb;
-      double s = 1.0/(sqrt(log(2.0)) / (2*M_PI*bt));
+      double s = 1.0/(sqrt(log(2.0)) / (2*GR_M_PI*bt));
       double t0 = -0.5 * ntaps;
       double ts;
       for(int i=0;i<ntaps;i++) {
@@ -621,7 +622,7 @@ namespace gr {
       for(int i = 0; i < ntaps; i++) {
 	double x1,x2,x3,num,den;
 	double xindx = i - ntaps/2;
-	x1 = M_PI * xindx/spb;
+	x1 = GR_M_PI * xindx/spb;
 	x2 = 4 * alpha * xindx / spb;
 	x3 = x2*x2 - 1;
 
@@ -629,8 +630,8 @@ namespace gr {
 	  if(i != ntaps/2)
 	    num = cos((1+alpha)*x1) + sin((1-alpha)*x1)/(4*alpha*xindx/spb);
 	  else
-	    num = cos((1+alpha)*x1) + (1-alpha) * M_PI / (4*alpha);
-	  den = x3 * M_PI;
+	    num = cos((1+alpha)*x1) + (1-alpha) * GR_M_PI / (4*alpha);
+	  den = x3 * GR_M_PI;
 	}
 	else {
 	  if(alpha==1) {
@@ -639,10 +640,10 @@ namespace gr {
 	  }
 	  x3 = (1-alpha)*x1;
 	  x2 = (1+alpha)*x1;
-	  num = (sin(x2)*(1+alpha)*M_PI
-		 - cos(x3)*((1-alpha)*M_PI*spb)/(4*alpha*xindx)
+	  num = (sin(x2)*(1+alpha)*GR_M_PI
+		 - cos(x3)*((1-alpha)*GR_M_PI*spb)/(4*alpha*xindx)
 		 + sin(x3)*spb*spb/(4*alpha*xindx*xindx));
-	  den = -32 * M_PI * alpha * alpha * xindx/spb;
+	  den = -32 * GR_M_PI * alpha * alpha * xindx/spb;
 	}
 	taps[i] = 4 * alpha * num / den;
 	scale += taps[i];
diff --git a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t
index f45426dafe..fc6ede2bb5 100644
--- a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t
+++ b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2003,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2003,2010,2012,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -31,6 +31,7 @@
 
 #include "@IMPL_NAME@.h"
 #include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
 #include <volk/volk.h>
 
 namespace gr {
@@ -90,7 +91,7 @@ namespace gr {
       // center frequency fwT0. We then apply a derotator
       // with -fwT0 to downshift the signal to baseband.
 
-      float fwT0 = 2 * M_PI * d_center_freq / d_sampling_freq;
+      float fwT0 = 2 * GR_M_PI * d_center_freq / d_sampling_freq;
       for(unsigned int i = 0; i < d_proto_taps.size(); i++) {
 	ctaps[i] = d_proto_taps[i] * exp(gr_complex(0, i * fwT0));
       }
diff --git a/gr-filter/lib/pfb_arb_resampler.cc b/gr-filter/lib/pfb_arb_resampler.cc
index 5c87447149..a311d702ac 100644
--- a/gr-filter/lib/pfb_arb_resampler.cc
+++ b/gr-filter/lib/pfb_arb_resampler.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2013 Free Software Foundation, Inc.
+ * Copyright 2013,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -26,9 +26,10 @@
 
 #include <gnuradio/filter/pfb_arb_resampler.h>
 #include <gnuradio/logger.h>
+#include <gnuradio/math.h>
+#include <boost/math/special_functions/round.hpp>
 #include <cstdio>
 #include <stdexcept>
-#include <boost/math/special_functions/round.hpp>
 
 namespace gr {
   namespace filter {
@@ -183,18 +184,18 @@ namespace gr {
       void
       pfb_arb_resampler_ccf::set_phase(float ph)
       {
-        if((ph < 0) || (ph >= 2.0*M_PI)) {
+        if((ph < 0) || (ph >= 2.0*GR_M_PI)) {
           throw std::runtime_error("pfb_arb_resampler_ccf: set_phase value out of bounds [0, 2pi).\n");
         }
 
-        float ph_diff = 2.0*M_PI / (float)d_filters.size();
+        float ph_diff = 2.0*GR_M_PI / (float)d_filters.size();
         d_last_filter = static_cast<int>(ph / ph_diff);
       }
 
       float
       pfb_arb_resampler_ccf::phase() const
       {
-        float ph_diff = 2.0*M_PI / static_cast<float>(d_filters.size());
+        float ph_diff = 2.0*GR_M_PI / static_cast<float>(d_filters.size());
         return d_last_filter * ph_diff;
       }
 
@@ -207,7 +208,7 @@ namespace gr {
       float
       pfb_arb_resampler_ccf::phase_offset(float freq, float fs)
       {
-        float adj = (2.0*M_PI)*(freq/fs)/static_cast<float>(d_int_rate);
+        float adj = (2.0*GR_M_PI)*(freq/fs)/static_cast<float>(d_int_rate);
         return -adj * d_est_phase_change;
       }
 
@@ -394,18 +395,18 @@ namespace gr {
       void
       pfb_arb_resampler_ccc::set_phase(float ph)
       {
-        if((ph < 0) || (ph >= 2.0*M_PI)) {
+        if((ph < 0) || (ph >= 2.0*GR_M_PI)) {
           throw std::runtime_error("pfb_arb_resampler_ccc: set_phase value out of bounds [0, 2pi).\n");
         }
 
-        float ph_diff = 2.0*M_PI / (float)d_filters.size();
+        float ph_diff = 2.0*GR_M_PI / (float)d_filters.size();
         d_last_filter = static_cast<int>(ph / ph_diff);
       }
 
       float
       pfb_arb_resampler_ccc::phase() const
       {
-        float ph_diff = 2.0*M_PI / static_cast<float>(d_filters.size());
+        float ph_diff = 2.0*GR_M_PI / static_cast<float>(d_filters.size());
         return d_last_filter * ph_diff;
       }
 
@@ -418,7 +419,7 @@ namespace gr {
       float
       pfb_arb_resampler_ccc::phase_offset(float freq, float fs)
       {
-        float adj = (2.0*M_PI)*(freq/fs)/static_cast<float>(d_int_rate);
+        float adj = (2.0*GR_M_PI)*(freq/fs)/static_cast<float>(d_int_rate);
         return -adj * d_est_phase_change;
       }
 
@@ -605,18 +606,18 @@ namespace gr {
       void
       pfb_arb_resampler_fff::set_phase(float ph)
       {
-        if((ph < 0) || (ph >= 2.0*M_PI)) {
+        if((ph < 0) || (ph >= 2.0*GR_M_PI)) {
           throw std::runtime_error("pfb_arb_resampler_fff: set_phase value out of bounds [0, 2pi).\n");
         }
 
-        float ph_diff = 2.0*M_PI / (float)d_filters.size();
+        float ph_diff = 2.0*GR_M_PI / (float)d_filters.size();
         d_last_filter = static_cast<int>(ph / ph_diff);
       }
 
       float
       pfb_arb_resampler_fff::phase() const
       {
-        float ph_diff = 2.0*M_PI / static_cast<float>(d_filters.size());
+        float ph_diff = 2.0*GR_M_PI / static_cast<float>(d_filters.size());
         return d_last_filter * ph_diff;
       }
 
@@ -629,7 +630,7 @@ namespace gr {
       float
       pfb_arb_resampler_fff::phase_offset(float freq, float fs)
       {
-        float adj = (2.0*M_PI)*(freq/fs)/static_cast<float>(d_int_rate);
+        float adj = (2.0*GR_M_PI)*(freq/fs)/static_cast<float>(d_int_rate);
         return -adj * d_est_phase_change;
       }
 
diff --git a/gr-filter/lib/pfb_decimator_ccf_impl.cc b/gr-filter/lib/pfb_decimator_ccf_impl.cc
index 9d1d6f6139..8136be7811 100644
--- a/gr-filter/lib/pfb_decimator_ccf_impl.cc
+++ b/gr-filter/lib/pfb_decimator_ccf_impl.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2009,2010,2012,2014 Free Software Foundation, Inc.
+ * Copyright 2009,2010,2012,2014,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -27,6 +27,7 @@
 #include "pfb_decimator_ccf_impl.h"
 #include <gnuradio/io_signature.h>
 #include <gnuradio/expj.h>
+#include <gnuradio/math.h>
 #include <volk/volk.h>
 
 namespace gr {
@@ -61,7 +62,7 @@ namespace gr {
       d_rate = decim;
       d_rotator = new gr_complex[d_rate];
       for(unsigned int i = 0; i < d_rate; i++) {
-        d_rotator[i] = gr_expj(i*d_chan*2*M_PI/d_rate);
+        d_rotator[i] = gr_expj(i*d_chan*2*GR_M_PI/d_rate);
       }
 
       set_relative_rate(1.0/(float)decim);
diff --git a/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc b/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc
index 9766cb93a3..79b058d7e7 100644
--- a/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc
+++ b/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2002,2007,2012 Free Software Foundation, Inc.
+ * Copyright 2002,2007,2012,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -24,15 +24,16 @@
 #include <config.h>
 #endif
 
-#include <cppunit/TestAssert.h>
 #include <qa_mmse_fir_interpolator_cc.h>
 #include <gnuradio/filter/mmse_fir_interpolator_cc.h>
 #include <gnuradio/fft/fft.h>
+#include <gnuradio/math.h>
 #include <volk/volk.h>
+#include <cppunit/TestAssert.h>
 #include <cstdio>
 #include <cmath>
 #include <stdexcept>
-#include <stdint.h>
+#include <cstdint>
 
 namespace gr {
   namespace filter {
@@ -40,15 +41,15 @@ namespace gr {
     static float
     test_fcn_sin(double index)
     {
-      return (2 * sin (index * 0.25 * 2 * M_PI + 0.125 * M_PI)
-	      + 3 * sin (index * 0.077 * 2 * M_PI + 0.3 * M_PI));
+      return (2 * sin (index * 0.25 * 2 * GR_M_PI + 0.125 * GR_M_PI)
+	      + 3 * sin (index * 0.077 * 2 * GR_M_PI + 0.3 * GR_M_PI));
     }
 
     static float
     test_fcn_cos(double index)
     {
-      return (2 * cos (index * 0.25 * 2 * M_PI + 0.125 * M_PI)
-	      + 3 * cos (index * 0.077 * 2 * M_PI + 0.3 * M_PI));
+      return (2 * cos (index * 0.25 * 2 * GR_M_PI + 0.125 * GR_M_PI)
+	      + 3 * cos (index * 0.077 * 2 * GR_M_PI + 0.3 * GR_M_PI));
     }
 
     static gr_complex
diff --git a/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc b/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc
index e9ee937230..56a3a1286d 100644
--- a/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc
+++ b/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2002,2012 Free Software Foundation, Inc.
+ * Copyright 2002,2012,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -24,11 +24,12 @@
 #include <config.h>
 #endif
 
-#include <cppunit/TestAssert.h>
 #include <qa_mmse_fir_interpolator_ff.h>
 #include <gnuradio/filter/mmse_fir_interpolator_ff.h>
 #include <gnuradio/fft/fft.h>
+#include <gnuradio/math.h>
 #include <volk/volk.h>
+#include <cppunit/TestAssert.h>
 #include <cstdio>
 #include <cmath>
 
@@ -38,8 +39,8 @@ namespace gr {
     static float
     test_fcn(double index)
     {
-      return (2 * sin(index * 0.25 * 2 * M_PI + 0.125 * M_PI)
-	      + 3 * sin(index * 0.077 * 2 * M_PI + 0.3 * M_PI));
+      return (2 * sin(index * 0.25 * 2 * GR_M_PI + 0.125 * GR_M_PI)
+	      + 3 * sin(index * 0.077 * 2 * GR_M_PI + 0.3 * GR_M_PI));
     }
 
     void
diff --git a/gr-filter/lib/qa_mmse_interp_differentiator_cc.cc b/gr-filter/lib/qa_mmse_interp_differentiator_cc.cc
index 55bb4e045b..8b8ec0c175 100644
--- a/gr-filter/lib/qa_mmse_interp_differentiator_cc.cc
+++ b/gr-filter/lib/qa_mmse_interp_differentiator_cc.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright (C) 2002,2007,2012,2017 Free Software Foundation, Inc.
+ * Copyright (C) 2002,2007,2012,2017,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -24,31 +24,32 @@
 #include <config.h>
 #endif
 
-#include <cppunit/TestAssert.h>
 #include <qa_mmse_interp_differentiator_cc.h>
 #include <gnuradio/filter/mmse_interp_differentiator_cc.h>
 #include <gnuradio/fft/fft.h>
+#include <gnuradio/math.h>
 #include <volk/volk.h>
+#include <cppunit/TestAssert.h>
 #include <cstdio>
 #include <cmath>
 #include <stdexcept>
-#include <stdint.h>
+#include <cstdint>
 
 namespace gr {
   namespace filter {
 
-    static const double k1 = 0.25 * 2 * M_PI;
-    static const double k2 = 0.125 * M_PI;
-    static const double k3 = 0.077 * 2 * M_PI;
-    static const double k4 = 0.3 * M_PI;
+    static const double k1 = 0.25 * 2 * GR_M_PI;
+    static const double k2 = 0.125 * GR_M_PI;
+    static const double k3 = 0.077 * 2 * GR_M_PI;
+    static const double k4 = 0.3 * GR_M_PI;
 
     static double
     phase_wrap(double arg)
     {
-      while (arg >= 2.0*M_PI)
-        arg -= 2.0*M_PI;
-      while (arg <= 2.0*M_PI)
-        arg += 2.0*M_PI;
+      while (arg >= 2.0*GR_M_PI)
+        arg -= 2.0*GR_M_PI;
+      while (arg <= 2.0*GR_M_PI)
+        arg += 2.0*GR_M_PI;
       return arg;
     }
 
diff --git a/gr-filter/lib/qa_mmse_interp_differentiator_ff.cc b/gr-filter/lib/qa_mmse_interp_differentiator_ff.cc
index 6736d11baa..9801f3e725 100644
--- a/gr-filter/lib/qa_mmse_interp_differentiator_ff.cc
+++ b/gr-filter/lib/qa_mmse_interp_differentiator_ff.cc
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright (C) 2002,2007,2012,2017 Free Software Foundation, Inc.
+ * Copyright (C) 2002,2007,2012,2017,2018 Free Software Foundation, Inc.
  *
  * This file is part of GNU Radio
  *
@@ -24,31 +24,32 @@
 #include <config.h>
 #endif
 
-#include <cppunit/TestAssert.h>
 #include <qa_mmse_interp_differentiator_ff.h>
 #include <gnuradio/filter/mmse_interp_differentiator_ff.h>
 #include <gnuradio/fft/fft.h>
+#include <gnuradio/math.h>
 #include <volk/volk.h>
+#include <cppunit/TestAssert.h>
 #include <cstdio>
 #include <cmath>
 #include <stdexcept>
-#include <stdint.h>
+#include <cstdint>
 
 namespace gr {
   namespace filter {
 
-    static const double k1 = 0.25 * 2 * M_PI;
-    static const double k2 = 0.125 * M_PI;
-    static const double k3 = 0.077 * 2 * M_PI;
-    static const double k4 = 0.3 * M_PI;
+    static const double k1 = 0.25 * 2 * GR_M_PI;
+    static const double k2 = 0.125 * GR_M_PI;
+    static const double k3 = 0.077 * 2 * GR_M_PI;
+    static const double k4 = 0.3 * GR_M_PI;
 
     static double
     phase_wrap(double arg)
     {
-      while (arg >= 2.0*M_PI)
-        arg -= 2.0*M_PI;
-      while (arg <= 2.0*M_PI)
-        arg += 2.0*M_PI;
+      while (arg >= 2.0*GR_M_PI)
+        arg -= 2.0*GR_M_PI;
+      while (arg <= 2.0*GR_M_PI)
+        arg += 2.0*GR_M_PI;
       return arg;
     }
 
-- 
cgit v1.2.3