33 #include "math_defs.h" 42 static uint32_t default_seed;
47 RANDOM_MAX=2147483647L
50 static double sin(
double p_x);
51 static double cos(
double p_x);
52 static double tan(
double p_x);
53 static double sinh(
double p_x);
54 static double cosh(
double p_x);
55 static double tanh(
double p_x);
56 static double asin(
double p_x);
57 static double acos(
double p_x);
58 static double atan(
double p_x);
59 static double atan2(
double p_y,
double p_x);
60 static double deg2rad(
double p_y);
61 static double rad2deg(
double p_y);
62 static double sqrt(
double p_x);
63 static double fmod(
double p_x,
double p_y);
64 static double fposmod(
double p_x,
double p_y);
65 static uint32_t rand_from_seed(uint32_t *seed);
66 static double floor(
double p_x);
67 static double ceil(
double p_x);
68 static double ease(
double p_x,
double p_c);
69 static int decimals(
double p_step);
70 static double stepify(
double p_value,
double p_step);
71 static void seed(uint32_t x=0);
72 static void randomize();
73 static uint32_t larger_prime(uint32_t p_val);
74 static double dectime(
double p_value,
double p_amount,
double p_step);
77 static inline double linear2db(
double p_linear) {
79 return Math::log( p_linear ) * 8.6858896380650365530225783783321;
82 static inline double db2linear(
double p_db) {
84 return Math::exp( p_db * 0.11512925464970228420089957273422 );
87 static bool is_nan(
double p_val);
88 static bool is_inf(
double p_val);
92 static uint32_t rand();
93 static double randf();
95 static double round(
double p_val);
97 static double random(
double from,
double to);
100 static _FORCE_INLINE_ real_t abs(real_t g) {
102 #ifdef REAL_T_IS_DOUBLE 111 static _FORCE_INLINE_
float absf(
float g) {
123 static _FORCE_INLINE_
double absd(
double g) {
130 u.i&=(uint64_t)9223372036854775807ll;
135 static _FORCE_INLINE_
int fast_ftoi(
float a) {
139 #if (defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0603) || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP // windows 8 phone? 140 b = (int)((a>0.0f) ? (a + 0.5f):(a -0.5f));
142 #elif defined(_MSC_VER) && _MSC_VER < 1800 161 #if defined(__GNUC__) 163 static _FORCE_INLINE_ int64_t dtoll(
double p_double) {
return (int64_t)p_double; }
166 static _FORCE_INLINE_ int64_t dtoll(
double p_double) {
return (int64_t)p_double; }
169 static _FORCE_INLINE_
float lerp(
float a,
float b,
float c) {
174 static double pow(
double x,
double y);
175 static double log(
double x);
176 static double exp(
double x);
181 #define Math_PI 3.14159265358979323846 182 #define Math_SQRT12 0.7071067811865475244008443621048490 184 #endif // MATH_FUNCS_H static _FORCE_INLINE_ float lerp(float a, float b, float c)
OPTIMIZE
Definition: math_funcs.h:169
Definition: math_funcs.h:39