32 lines
553 B
C
32 lines
553 B
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdlib.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);
|
|
}
|
|
|
|
IMPORT(Math_sin) double sin(double x);
|
|
static inline double cos(double x) {
|
|
return sin(x + M_PI_2);
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|