2015-11-01 04:43:55 -08:00
|
|
|
#ifndef AL_MATH_DEFS_H
|
|
|
|
#define AL_MATH_DEFS_H
|
|
|
|
|
2017-05-20 03:28:40 -07:00
|
|
|
#include <math.h>
|
2015-11-06 02:38:34 -08:00
|
|
|
#ifdef HAVE_FLOAT_H
|
|
|
|
#include <float.h>
|
|
|
|
#endif
|
|
|
|
|
2018-03-22 09:55:15 -07:00
|
|
|
#ifndef M_PI
|
|
|
|
#define M_PI (3.14159265358979323846)
|
|
|
|
#endif
|
|
|
|
|
2015-11-01 04:43:55 -08:00
|
|
|
#define F_PI (3.14159265358979323846f)
|
|
|
|
#define F_PI_2 (1.57079632679489661923f)
|
|
|
|
#define F_TAU (6.28318530717958647692f)
|
|
|
|
|
|
|
|
#ifndef FLT_EPSILON
|
|
|
|
#define FLT_EPSILON (1.19209290e-07f)
|
|
|
|
#endif
|
|
|
|
|
2018-09-19 19:53:25 -07:00
|
|
|
#define SQRT_2 1.41421356237309504880
|
|
|
|
#define SQRT_3 1.73205080756887719318
|
|
|
|
|
|
|
|
#define SQRTF_2 1.41421356237309504880f
|
|
|
|
#define SQRTF_3 1.73205080756887719318f
|
|
|
|
|
2017-05-20 03:28:40 -07:00
|
|
|
#ifndef HUGE_VALF
|
2017-06-29 09:57:19 -07:00
|
|
|
static const union msvc_inf_hack {
|
|
|
|
unsigned char b[4];
|
|
|
|
float f;
|
|
|
|
} msvc_inf_union = {{ 0x00, 0x00, 0x80, 0x7F }};
|
|
|
|
#define HUGE_VALF (msvc_inf_union.f)
|
2017-05-20 03:28:40 -07:00
|
|
|
#endif
|
|
|
|
|
2018-05-14 00:20:31 -07:00
|
|
|
#define DEG2RAD(x) ((float)(x) * (float)(M_PI/180.0))
|
|
|
|
#define RAD2DEG(x) ((float)(x) * (float)(180.0/M_PI))
|
2015-11-01 04:43:55 -08:00
|
|
|
|
|
|
|
#endif /* AL_MATH_DEFS_H */
|