2021-07-25 16:48:36 -05:00
|
|
|
#ifndef _MATH_H_
|
|
|
|
|
#define _MATH_H_
|
|
|
|
|
|
2021-08-08 17:32:34 -05:00
|
|
|
// stop gcc from complaining
|
|
|
|
|
#ifndef __MWERKS__
|
|
|
|
|
extern int __abs(int);
|
2021-08-08 21:31:51 -05:00
|
|
|
extern float __fabs(float);
|
2022-01-31 22:42:10 -06:00
|
|
|
extern float __frsqrte(float);
|
2021-08-08 17:32:34 -05:00
|
|
|
#endif
|
|
|
|
|
|
2021-07-29 18:52:07 -05:00
|
|
|
#define NAN (0.0f / 0.0f)
|
|
|
|
|
#define HUGE_VALF (1.0f / 0.0f)
|
|
|
|
|
#define INFINITY (1.0f / 0.0f)
|
|
|
|
|
|
2021-12-22 16:47:45 -06:00
|
|
|
#define FLT_EPSILON 1.1920928955078125e-07f
|
|
|
|
|
|
2021-07-25 16:48:36 -05:00
|
|
|
double fabs(double x);
|
|
|
|
|
double sin(double x);
|
|
|
|
|
double cos(double x);
|
|
|
|
|
|
|
|
|
|
float sinf(float x);
|
|
|
|
|
float acosf(float x);
|
|
|
|
|
|
2021-11-10 23:34:39 -06:00
|
|
|
double ldexp(double x, int exp);
|
|
|
|
|
|
2022-01-31 19:55:03 -06:00
|
|
|
inline int abs(int n) { return(__abs(n)); }
|
2021-08-08 17:32:34 -05:00
|
|
|
|
2022-01-31 20:26:29 -06:00
|
|
|
double scalbn(double x, int n);
|
2022-01-31 19:55:03 -06:00
|
|
|
|
|
|
|
|
double copysign(double x, double y);
|
2021-11-10 23:34:39 -06:00
|
|
|
|
2022-04-17 17:02:56 -04:00
|
|
|
double floor(double x);
|
2022-01-31 20:26:29 -06:00
|
|
|
|
2022-01-31 20:57:51 -06:00
|
|
|
double fabs(double x);
|
|
|
|
|
|
2021-11-10 23:34:39 -06:00
|
|
|
#ifdef __MWERKS__
|
|
|
|
|
#pragma cplusplus on
|
2022-01-31 19:55:03 -06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
long __fpclassifyf(float x);
|
|
|
|
|
long __fpclassifyd(double x);
|
|
|
|
|
|
2022-01-31 21:09:33 -06:00
|
|
|
#define FP_NAN 1
|
2022-01-31 19:55:03 -06:00
|
|
|
#define FP_INFINITE 2
|
2022-01-31 21:09:33 -06:00
|
|
|
#define FP_ZERO 3
|
|
|
|
|
#define FP_NORMAL 4
|
|
|
|
|
#define FP_SUBNORMAL 5
|
|
|
|
|
|
2022-01-31 19:55:03 -06:00
|
|
|
#define fpclassify(x) (sizeof(x) == sizeof(float) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)))
|
|
|
|
|
#define isfinite(x) ((fpclassify(x) > FP_INFINITE))
|
|
|
|
|
|
|
|
|
|
#ifdef __MWERKS__
|
2021-11-10 23:34:39 -06:00
|
|
|
#pragma cplusplus reset
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-07-25 16:48:36 -05:00
|
|
|
#endif
|