]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/warpzonelib/mathlib.qh
Merge remote-tracking branch 'origin/master' into samual/spawn_weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / warpzonelib / mathlib.qh
1 // <math.h>
2
3 // The commented-out functions need no implementation because DarkPlaces offers
4 // them as builtins. They are listed here anyway for completeness sake.
5
6 #define int float
7
8 #define FP_NAN 0
9 #define FP_INFINITE 1
10 #define FP_ZERO 2
11 #define FP_SUBNORMAL 3
12 #define FP_NORMAL 4
13 int fpclassify(float x);
14 int isfinite(float x);
15 int isinf(float x);
16 int isnan(float x);
17 int isnormal(float x);
18 int signbit(float x);
19
20 //float acos(float x);
21 //float asin(float x);
22 //float atan(float x);
23 //float atan2(float y, float x);
24 //float cos(float x);
25 //float sin(float x);
26 //float tan(float x);
27
28 float acosh(float x);
29 float asinh(float x);
30 float atanh(float x);
31 float cosh(float x);
32 float sinh(float x);
33 float tanh(float x);
34
35 float exp(float x);
36 float exp2(float x);
37 float expm1(float x);
38
39 vector frexp(float x); // returns mantissa as _x, exponent as _y
40 int ilogb(float x);
41 float ldexp(float x, int e);
42 //float log(float x);
43 float log10(float x);
44 float log1p(float x);
45 float log2(float x);
46 float logb(float x);
47 vector modf(float f); // fraction as _x, integer as _y
48
49 float scalbn(float x, int n);
50
51 float cbrt(float x);
52 //float fabs(float x);
53 float hypot(float x, float y);
54 //float pow(float x, float y);
55 //float sqrt(float x, float y);
56
57 float erf(float x);
58 float erfc(float x);
59 vector lgamma(float x); // value in _x, sign in _y
60 float tgamma(float x);
61
62 //float ceil(float x);
63 //float floor(float x);
64 float nearbyint(float x);
65 //float rint(float x);
66 //float round(float x);
67 float trunc(float x);
68
69 float fmod(float x, float y);
70 float remainder(float x, float y);
71 vector remquo(float x, float y);
72
73 float copysign(float x, float y);
74 float nan(string tag);
75 float nextafter(float x, float y);
76 float nexttoward(float x, float y);
77
78 float fdim(float x, float y);
79 float fmax(float x, float y);
80 float fmin(float x, float y);
81 float fma(float x, float y, float z);
82
83 int isgreater(float x, float y);
84 int isgreaterequal(float x, float y);
85 int isless(float x, float y);
86 int islessequal(float x, float y);
87 int islessgreater(float x, float y);
88 int isunordered(float x, float y);
89
90 #define M_E        2.7182818284590452354   /* e */
91 #define M_LOG2E    1.4426950408889634074   /* log_2 e */
92 #define M_LOG10E   0.43429448190325182765  /* log_10 e */
93 #define M_LN2      0.69314718055994530942  /* log_e 2 */
94 #define M_LN10     2.30258509299404568402  /* log_e 10 */
95 #define M_PI       3.14159265358979323846  /* pi */
96 #define M_PI_2     1.57079632679489661923  /* pi/2 */
97 #define M_PI_4     0.78539816339744830962  /* pi/4 */
98 #define M_1_PI     0.31830988618379067154  /* 1/pi */
99 #define M_2_PI     0.63661977236758134308  /* 2/pi */
100 #define M_2_SQRTPI 1.12837916709551257390  /* 2/sqrt(pi) */
101 #define M_SQRT2    1.41421356237309504880  /* sqrt(2) */
102 #define M_SQRT1_2  0.70710678118654752440  /* 1/sqrt(2) */