23 #ifndef INCLUDED_GR_FXPT_H
24 #define INCLUDED_GR_FXPT_H
43 static const int WORDBITS = 32;
44 static const int NBITS = 10;
45 static const float s_sine_table[1 << NBITS][2];
46 static const float PI;
47 static const float TWO_TO_THE_31;
54 int d = (int)floor(x/2/PI+0.5);
57 return (
gr_int32) ((float) x * TWO_TO_THE_31 / PI);
63 return x * (PI / TWO_TO_THE_31);
73 int index = ux >> (WORDBITS - NBITS);
74 return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1];
84 int index = ux >> (WORDBITS - NBITS);
85 return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1];
94 int sin_index = ux >> (WORDBITS - NBITS);
95 *s = s_sine_table[sin_index][0] * (ux >> 1) + s_sine_table[sin_index][1];
98 int cos_index = ux >> (WORDBITS - NBITS);
99 *c = s_sine_table[cos_index][0] * (ux >> 1) + s_sine_table[cos_index][1];
fixed point sine and cosine and friends.fixed pt radians -2**31 -pi 0 0 2**31-1 pi - epsilon ...
Definition: fxpt.h:41
static float sin(gr_int32 x)
Given a fixed point angle x, return float sine (x)
Definition: fxpt.h:70
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:30
static float cos(gr_int32 x)
Definition: fxpt.h:81
unsigned int gr_uint32
Definition: gnuradio-runtime/include/gnuradio/types.h:61
int gr_int32
Definition: gnuradio-runtime/include/gnuradio/types.h:58
static void sincos(gr_int32 x, float *s, float *c)
Definition: fxpt.h:91
static gr_int32 float_to_fixed(float x)
Definition: fxpt.h:51
static float fixed_to_float(gr_int32 x)
Definition: fxpt.h:61