[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/03: frequency_modulator_fc: float modulo
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/03: frequency_modulator_fc: float modulo using cmath |
Date: |
Sun, 12 Jul 2015 16:36:40 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 9ae9a10cadec5c1ea7c03677cc685b3a92591967
Author: Marcus Müller <address@hidden>
Date: Tue Jul 7 16:46:30 2015 +0200
frequency_modulator_fc: float modulo using cmath
---
gr-analog/lib/frequency_modulator_fc_impl.cc | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/gr-analog/lib/frequency_modulator_fc_impl.cc
b/gr-analog/lib/frequency_modulator_fc_impl.cc
index 1158167..812eb8b 100644
--- a/gr-analog/lib/frequency_modulator_fc_impl.cc
+++ b/gr-analog/lib/frequency_modulator_fc_impl.cc
@@ -27,8 +27,7 @@
#include "frequency_modulator_fc_impl.h"
#include <gnuradio/io_signature.h>
#include <gnuradio/fxpt.h>
-#include <math.h>
-#include <boost/math/special_functions/trunc.hpp>
+#include <cmath>
namespace gr {
namespace analog {
@@ -63,10 +62,9 @@ namespace gr {
for(int i = 0; i < noutput_items; i++) {
d_phase = d_phase + d_sensitivity * in[i];
- while(d_phase > (float)(M_PI))
- d_phase -= (float)(2.0 * M_PI);
- while(d_phase < (float)(-M_PI))
- d_phase += (float)(2.0 * M_PI);
+ //place phase in [-pi, +pi[
+ #define F_PI ((float)(M_PI))
+ d_phase = std::fmod(d_phase + F_PI, 2.0f * F_PI) - F_PI;
float oi, oq;