HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
math_ops.h
Go to the documentation of this file.
1
6
#ifndef _MATH_OPS_H_
7
#define _MATH_OPS_H_
8
9
#include <math.h>
10
14
#define min(a,b) ((a)<(b)?(a):(b))
15
18
#define max(a,b) ((a)>(b)?(a):(b))
19
23
#define min3(a,b,c) min(min((a),(b)),min((b),(c)))
24
27
#define max3(a,b,c) max(max((a),(b)),max((b),(c)))
28
32
#define absolute(a) ((a)<0?-(a):(a))
33
37
#define raiseto(x,a) (exp((a)*log(x)))
38
42
#define raiseto_int(y,x,a) \
43
{ \
44
int arraycounter; \
45
y = x; \
46
for (arraycounter=1; arraycounter<a; arraycounter++) { \
47
y *= x; \
48
} \
49
}
50
54
#define sign(a) ((a)<0?-1.0:1.0)
55
56
#endif