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