]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/warpzonelib/mathlib.qh
#include this
[xonotic/xonotic-data.pk3dir.git] / qcsrc / warpzonelib / mathlib.qh
1 #ifndef MATHLIB_H
2 #define MATHLIB_H
3
4 #if defined(CSQC)
5     #include "../common/util-pre.qh"
6     #include "../client/sys-pre.qh"
7     #include "../dpdefs/csprogsdefs.qc"
8     #include "../client/sys-post.qh"
9     #include "../client/Defs.qc"
10     #include "../dpdefs/keycodes.qc"
11     #include "../common/constants.qh"
12     #include "../common/stats.qh"
13     #include "anglestransform.qh"
14 #elif defined(MENUQC)
15     #include "../common/util-pre.qh"
16     #include "../menu/sys-pre.qh"
17     #include "../dpdefs/menudefs.qc"
18     #include "../dpdefs/keycodes.qc"
19     #include "../menu/sys-post.qh"
20     #include "../menu/config.qh"
21 #elif defined(SVQC)
22     #include "../common/util-pre.qh"
23     #include "../server/sys-pre.qh"
24     #include "../dpdefs/progsdefs.qc"
25     #include "../dpdefs/dpextensions.qc"
26     #include "../server/sys-post.qh"
27     #include "anglestransform.qh"
28 #endif
29
30 // <math.h>
31
32 // The commented-out functions need no implementation because DarkPlaces offers
33 // them as builtins. They are listed here anyway for completeness sake.
34
35 const float FP_NAN = 0;
36 const float FP_INFINITE = 1;
37 const float FP_ZERO = 2;
38 const float FP_SUBNORMAL = 3;
39 const float FP_NORMAL = 4;
40 int fpclassify(float x);
41 int isfinite(float x);
42 int isinf(float x);
43 int isnan(float x);
44 int isnormal(float x);
45 int signbit(float x);
46
47 //float acos(float x);
48 //float asin(float x);
49 //float atan(float x);
50 //float atan2(float y, float x);
51 //float cos(float x);
52 //float sin(float x);
53 //float tan(float x);
54
55 float acosh(float x);
56 float asinh(float x);
57 float atanh(float x);
58 float cosh(float x);
59 float sinh(float x);
60 float tanh(float x);
61
62 float exp(float x);
63 float exp2(float x);
64 float expm1(float x);
65
66 vector frexp(float x); // returns mantissa as _x, exponent as _y
67 int ilogb(float x);
68 float ldexp(float x, int e);
69 //float log(float x);
70 float log10(float x);
71 float log1p(float x);
72 float log2(float x);
73 float logb(float x);
74 vector modf(float f); // fraction as _x, integer as _y
75
76 float scalbn(float x, int n);
77
78 float cbrt(float x);
79 //float fabs(float x);
80 float hypot(float x, float y);
81 //float pow(float x, float y);
82 //float sqrt(float x, float y);
83
84 float erf(float x);
85 float erfc(float x);
86 vector lgamma(float x); // value in _x, sign in _y
87 float tgamma(float x);
88
89 //float ceil(float x);
90 //float floor(float x);
91 float nearbyint(float x);
92 //float rint(float x);
93 //float round(float x);
94 float trunc(float x);
95
96 float fmod(float x, float y);
97 float remainder(float x, float y);
98 vector remquo(float x, float y);
99
100 float copysign(float x, float y);
101 float nan(string tag);
102 float nextafter(float x, float y);
103 float nexttoward(float x, float y);
104
105 float fdim(float x, float y);
106 float fmax(float x, float y);
107 float fmin(float x, float y);
108 float fma(float x, float y, float z);
109
110 int isgreater(float x, float y);
111 int isgreaterequal(float x, float y);
112 int isless(float x, float y);
113 int islessequal(float x, float y);
114 int islessgreater(float x, float y);
115 int isunordered(float x, float y);
116
117 const float M_E        = 2.7182818284590452354;   /* e */
118 const float M_LOG2E    = 1.4426950408889634074;   /* log_2 e */
119 const float M_LOG10E   = 0.43429448190325182765;  /* log_10 e */
120 const float M_LN2      = 0.69314718055994530942;  /* log_e 2 */
121 const float M_LN10     = 2.30258509299404568402;  /* log_e 10 */
122 const float M_PI       = 3.14159265358979323846;  /* pi */
123 const float M_PI_2     = 1.57079632679489661923;  /* pi/2 */
124 const float M_PI_4     = 0.78539816339744830962;  /* pi/4 */
125 const float M_1_PI     = 0.31830988618379067154;  /* 1/pi */
126 const float M_2_PI     = 0.63661977236758134308;  /* 2/pi */
127 const float M_2_SQRTPI = 1.12837916709551257390;  /* 2/sqrt(pi) */
128 const float M_SQRT2    = 1.41421356237309504880;  /* sqrt(2) */
129 const float M_SQRT1_2  = 0.70710678118654752440;  /* 1/sqrt(2) */
130 #endif