Move some ambisonic-related macros to a separate header
[openal-soft.git] / common / math_defs.h
blob513570f0ef35a91e5f17c7dc2762dff2d9f895c8
1 #ifndef AL_MATH_DEFS_H
2 #define AL_MATH_DEFS_H
4 #include <math.h>
5 #ifdef HAVE_FLOAT_H
6 #include <float.h>
7 #endif
9 #ifndef M_PI
10 #define M_PI (3.14159265358979323846)
11 #endif
13 #define F_PI (3.14159265358979323846f)
14 #define F_PI_2 (1.57079632679489661923f)
15 #define F_TAU (6.28318530717958647692f)
17 #ifndef FLT_EPSILON
18 #define FLT_EPSILON (1.19209290e-07f)
19 #endif
21 #define SQRT_2 1.41421356237309504880
22 #define SQRT_3 1.73205080756887719318
24 #define SQRTF_2 1.41421356237309504880f
25 #define SQRTF_3 1.73205080756887719318f
27 #ifndef HUGE_VALF
28 static const union msvc_inf_hack {
29 unsigned char b[4];
30 float f;
31 } msvc_inf_union = {{ 0x00, 0x00, 0x80, 0x7F }};
32 #define HUGE_VALF (msvc_inf_union.f)
33 #endif
35 #define DEG2RAD(x) ((float)(x) * (float)(M_PI/180.0))
36 #define RAD2DEG(x) ((float)(x) * (float)(180.0/M_PI))
38 #endif /* AL_MATH_DEFS_H */