FNFT
fnft_numtypes.h
Go to the documentation of this file.
1 /*
2 * This file is part of FNFT.
3 *
4 * FNFT is free software; you can redistribute it and/or
5 * modify it under the terms of the version 2 of the GNU General
6 * Public License as published by the Free Software Foundation.
7 *
8 * FNFT is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Contributors:
17 * Sander Wahls (TU Delft) 2017-2018.
18 */
19 
27 #ifndef FNFT_NUMTYPES_H
28 #define FNFT_NUMTYPES_H
29 
30 #include <math.h>
31 #include <float.h>
32 #include <complex.h>
33 #include <stdint.h>
34 #include <stdlib.h>
35 
40 typedef double FNFT_REAL;
41 
46 #ifndef __cplusplus
47 typedef double complex FNFT_COMPLEX;
48 #else
49 typedef std::complex<double> FNFT_COMPLEX;
50 #endif
51 
56 typedef int32_t FNFT_INT;
57 
62 typedef size_t FNFT_UINT;
63 
68 #define FNFT_EPSILON DBL_EPSILON
69 
74 #define FNFT_NAN NAN
75 
80 #define FNFT_INF INFINITY
81 
86 #define FNFT_FABS(X) fabs(X)
87 
92 #define FNFT_SQRT(X) sqrt(X)
93 
98 #define FNFT_COS(X) cos(X)
99 
104 #define FNFT_SIN(X) sin(X)
105 
110 #define FNFT_SINH(X) sinh(X)
111 
116 #define FNFT_COSH(X) cosh(X)
117 
122 #define FNFT_ATAN(X) atan(X)
123 
128 #define FNFT_LOG(X) log(X)
129 
134 #define FNFT_LOG2(X) log2(X)
135 
140 #define FNFT_POW(X, Y) pow(X, Y)
141 
146 #define FNFT_GAMMA(X) tgamma(X)
147 
153 #define FNFT_PI acos(-1.0)
154 
160 #define FNFT_FLOOR(X) floor(X)
161 
167 #define FNFT_ROUND(X) round(X)
168 
174 #define FNFT_CEIL(X) ceil(X)
175 
180 #define FNFT_HYPOT(X,Y) hypot(X,Y)
181 
186 #define FNFT_CREAL(X) creal(X)
187 
192 #define FNFT_CIMAG(X) cimag(X)
193 
198 #define FNFT_CABS(X) cabs(X)
199 
204 #define FNFT_CARG(X) carg(X)
205 
210 #define FNFT_CONJ(X) conj(X)
211 
216 #define FNFT_CPOW(X,Y) cpow(X,Y)
217 
222 #define FNFT_CEXP(X) cexp(X)
223 
228 #define FNFT_CLOG(X) clog(X)
229 
234 #define FNFT_CSQRT(X) csqrt(X)
235 
240 #define FNFT_CSINH(X) csinh(X)
241 
246 #define FNFT_CCOSH(X) ccosh(X)
247 
251 #define FNFT_CSIN(X) csin(X)
252 
256 #define FNFT_CCOS(X) ccos(X)
257 
261 #define FNFT_ATANH(X) atanh(X)
262 
263 #ifdef FNFT_ENABLE_SHORT_NAMES
264 #define REAL FNFT_REAL
265 #define COMPLEX FNFT_COMPLEX
266 #define INT FNFT_INT
267 #define UINT FNFT_UINT
268 #define CABS(X) FNFT_CABS(X)
269 #define FABS(X) FNFT_FABS(X)
270 #define FLOOR(X) FNFT_FLOOR(X)
271 #define CEIL(X) FNFT_CEIL(X)
272 #define ROUND(X) FNFT_ROUND(X)
273 #define POW(X,Y) FNFT_POW(X,Y)
274 #define CPOW(X,Y) FNFT_CPOW(X,Y)
275 #define LOG2(X) FNFT_LOG2(X)
276 #define LOG(X) FNFT_LOG(X)
277 #define CLOG(X) FNFT_CLOG(X)
278 #define COS(X) FNFT_COS(X)
279 #define SIN(X) FNFT_SIN(X)
280 #define ATAN(X) FNFT_ATAN(X)
281 #define SQRT(X) FNFT_SQRT(X)
282 #define EPSILON FNFT_EPSILON
283 #define CSINH(X) FNFT_CSINH(X)
284 #define CCOSH(X) FNFT_CCOSH(X)
285 #define CCOS(X) FNFT_CCOS(X)
286 #define CSIN(X) FNFT_CSIN(X)
287 #define COSH(X) FNFT_COSH(X)
288 #define SINH(X) FNFT_SINH(X)
289 #define HYPOT(X,Y) FNFT_HYPOT(X,Y)
290 #define CREAL(X) FNFT_CREAL(X)
291 #define CIMAG(X) FNFT_CIMAG(X)
292 #define CONJ(X) FNFT_CONJ(X)
293 #define CSQRT(X) FNFT_CSQRT(X)
294 #define CEXP(X) FNFT_CEXP(X)
295 #define CARG(X) FNFT_CARG(X)
296 #define PI FNFT_PI
297 #define GAMMA(X) FNFT_GAMMA(X)
298 #define ATANH(X) FNFT_ATANH(X)
299 #endif
300 
301 #endif
302 
FNFT_INT
int32_t FNFT_INT
Definition: fnft_numtypes.h:56
FNFT_UINT
size_t FNFT_UINT
Definition: fnft_numtypes.h:62
FNFT_COMPLEX
double complex FNFT_COMPLEX
Definition: fnft_numtypes.h:47
FNFT_REAL
double FNFT_REAL
Definition: fnft_numtypes.h:40