summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib
diff options
context:
space:
mode:
authorTom Rondeau2012-03-18 20:05:21 -0400
committerTom Rondeau2012-03-18 20:05:21 -0400
commitb05ac49ced6a9b4cd4e4ba2d0a3ed74b6979dcc8 (patch)
treec014d27fcd12a37176a737a2d013626e0e6d2c96 /gnuradio-core/src/lib
parent70c625e9cec45bb8d2c31a0d3db0068c529f39fb (diff)
parentbbddd082607a8632322d7774ae8ad54e7e84f6de (diff)
downloadgnuradio-b05ac49ced6a9b4cd4e4ba2d0a3ed74b6979dcc8.tar.gz
gnuradio-b05ac49ced6a9b4cd4e4ba2d0a3ed74b6979dcc8.tar.bz2
gnuradio-b05ac49ced6a9b4cd4e4ba2d0a3ed74b6979dcc8.zip
Merge branch 'master' into next
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r--gnuradio-core/src/lib/general/gr_fxpt.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/gnuradio-core/src/lib/general/gr_fxpt.h b/gnuradio-core/src/lib/general/gr_fxpt.h
index 5cf736dfb..9f5937d1a 100644
--- a/gnuradio-core/src/lib/general/gr_fxpt.h
+++ b/gnuradio-core/src/lib/general/gr_fxpt.h
@@ -26,7 +26,7 @@
#include <gr_types.h>
/*!
- * \brief fixed point sine and cosine and friend GR_CORE_APIs.
+ * \brief fixed point sine and cosine and friends.
* \ingroup misc
*
* fixed pt radians
@@ -48,6 +48,10 @@ public:
static gr_int32
float_to_fixed (float x)
{
+ // Fold x into -PI to PI.
+ int d = (int)floor(x/2/PI+0.5);
+ x -= d*2*PI;
+ // And convert to an integer.
return (gr_int32) ((float) x * TWO_TO_THE_31 / PI);
}