2 This file is part of a program that implements a Software-Defined Radio.
4 Copyright (C) 2004 by Frank Brickle, AB2KT and Bob McGwier, N4HY
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 The authors can be reached by email at
28 The DTTS Microwave Society
38 #include <splitfields.h>
39 #include <datatypes.h>
46 #define SIN_TABLE_SIZE 4096
47 #define SIN_TABLE_SIZE_M1 4095
49 /* **********************************************
52 * 1 = table look up with interpolation (medium);
53 * 2 = table look up (fast)
54 * ***********************************************/
56 /* Interpolation is ALWAYS done on atan2. The setting
57 only applies to sin and cos */
64 #define SIN(x) fast_sin(x)
65 #define COS(x) fast_cos(x)
66 #define ATAN2(x,y) fast_atan2((x),(y))
68 #elif (TRIG_SPEED == 1)
70 #define SIN(x) fast_sin(x)
71 #define COS(x) fast_cos(x)
72 #define ATAN2(x,y) fast_atan2((x),(y))
74 #elif (TRIG_SPEED == 0)
76 #define SIN(x) (REAL)sin((REAL)x)
77 #define COS(x) (REAL)cos((REAL)x)
78 #define ATAN2(x,y) (REAL)atan2((REAL)(x),(REAL)(y))
87 #define TWOPI (2.0 * PI)
90 #ifndef ONE_OVER_TWOPI
91 #define ONE_OVER_TWOPI (0.159154943091895)
96 extern void InitSPEEDTRIG(void);
97 extern REAL fast_sin(REAL);
98 extern REAL fast_cos(REAL);
99 extern REAL fast_atan2(REAL, REAL);