summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <jcorgan@corganenterprises.com>2011-03-14 19:44:49 -0700
committerJohnathan Corgan <jcorgan@corganenterprises.com>2011-03-14 19:44:49 -0700
commitcd3c58cd66533fc66a8be4021c2c9074abd34b30 (patch)
tree5db768fd93bd44baf1c9e31eabf388c93ba4004d
parent7df5b10ddcd64309a5c299f662a4cd62a7d175ab (diff)
parent8e5f4bc89af1682b258ecb1bc46b04d24ea3addd (diff)
Merge remote branch 'jblum/mergeme/misc/use_boost_math_trunc' into next
* jblum/mergeme/misc/use_boost_math_trunc: use boost::math::trunc in gr_frequency_modulator_fc.cc
-rw-r--r--configure.ac9
-rw-r--r--gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc5
2 files changed, 3 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index e707ed7771..73ebbd6af0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -219,20 +219,11 @@ AC_CHECK_LIB(m, sincos, [AC_DEFINE([HAVE_SINCOS],[1],[Define to 1 if your system
AC_CHECK_LIB(m, sincosf,[AC_DEFINE([HAVE_SINCOSF],[1],[Define to 1 if your system has `sincosf'.])])
AC_CHECK_LIB(m, sinf, [AC_DEFINE([HAVE_SINF],[1],[Define to 1 if your system has `sinf'.])])
AC_CHECK_LIB(m, cosf, [AC_DEFINE([HAVE_COSF],[1],[Define to 1 if your system has `cosf'.])])
-AC_CHECK_LIB(m, trunc, [AC_DEFINE([HAVE_TRUNC],[1],[Define to 1 if your system has `trunc'.])])
AC_CHECK_LIB(m, exp10, [AC_DEFINE([HAVE_EXP10],[1],[Define to 1 if your system has 'exp10'.])])
AC_CHECK_LIB(m, log2, [AC_DEFINE([HAVE_LOG2],[1],[Define to 1 if your system has 'log2'.])])
#AC_FUNC_MKTIME
AH_BOTTOM([
-#ifndef HAVE_TRUNC
-#include <math.h>
-inline static double trunc(double x)
-{
- return x >= 0 ? floor(x) : ceil(x);
-}
-#endif
-
#ifndef HAVE_EXP10
#include <math.h>
inline static double exp10(double x)
diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc
index 0f6f0d719f..bff22be250 100644
--- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc
+++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -28,6 +28,7 @@
#include <gr_io_signature.h>
#include <gr_sincos.h>
#include <math.h>
+#include <boost/math/special_functions/trunc.hpp>
gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity)
@@ -62,7 +63,7 @@ gr_frequency_modulator_fc::work (int noutput_items,
// to avoid loss of precision in the addition above.
if (fabs (d_phase) > 16 * M_PI){
- double ii = trunc (d_phase / (2 * M_PI));
+ double ii = boost::math::trunc (d_phase / (2 * M_PI));
d_phase = d_phase - (ii * 2 * M_PI);
}