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>
43 #define SIN_TABLE_SIZE 4096
44 #define SIN_TABLE_SIZE_M1 4095
46 /* **********************************************
49 * 1 = table look up with interpolation (medium);
50 * 2 = table look up (fast)
51 * ***********************************************/
53 /* Interpolation is ALWAYS done on atan2. The setting
54 only applies to sin and cos */
61 #define SIN(x) fast_sin(x)
62 #define COS(x) fast_cos(x)
63 #define ATAN2(x,y) fast_atan2((x),(y))
65 #elif (TRIG_SPEED == 1)
67 #define SIN(x) fast_sin(x)
68 #define COS(x) fast_cos(x)
69 #define ATAN2(x,y) fast_atan2((x),(y))
71 #elif (TRIG_SPEED == 0)
73 #define SIN(x) (REAL)sin((REAL)x)
74 #define COS(x) (REAL)cos((REAL)x)
75 #define ATAN2(x,y) (REAL)atan2((REAL)(x),(REAL)(y))
84 #define TWOPI (2.0 * PI)
87 #ifndef ONE_OVER_TWOPI
88 #define ONE_OVER_TWOPI (0.159154943091895)
93 extern void InitSPEEDTRIG(void);
94 extern REAL fast_sin(REAL);
95 extern REAL fast_cos(REAL);
96 extern REAL fast_atan2(REAL, REAL);