36 lines
615 B
C
36 lines
615 B
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
|
|
#define M_PI 3.14159265359
|
|
#define M_PI_2 1.57079632679
|
|
|
|
#define abs(x) (((x) < 0) ? -(x) : (x))
|
|
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
|
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
static inline bool isnan(double x) {
|
|
return x != x;
|
|
}
|
|
static inline bool isinf(double x) {
|
|
return !isnan(x) && isnan(x - x);
|
|
}
|
|
|
|
float sinf(float x);
|
|
static inline float cosf(float x) {
|
|
return sinf(x + M_PI_2);
|
|
}
|
|
static inline float tanf(float x) {
|
|
return sinf(x) / cosf(x);
|
|
}
|
|
|
|
float fmodf(float x, float y);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|