Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
mathlib.qh
Go to the documentation of this file.
1#pragma once
2
3// <math.h>
4
5// The commented-out functions need no implementation because DarkPlaces offers
6// them as builtins. They are listed here anyway for completeness sake.
7
8const int FP_NAN = 0;
9const int FP_INFINITE = 1;
10const int FP_ZERO = 2;
11const int FP_SUBNORMAL = 3;
12const int FP_NORMAL = 4;
13int fpclassify(float e);
14bool isfinite(float e);
15bool isinf(float e);
16bool isnan(float e);
17bool isnormal(float e);
18bool signbit(float e);
19
20//float acos(float e);
21//float asin(float e);
22//float atan(float e);
23//float atan2(float f, float e);
24//float cos(float e);
25//float sin(float e);
26//float tan(float e);
27
28float acosh(float e);
29float asinh(float e);
30float atanh(float e);
31float cosh(float e);
32float sinh(float e);
33float tanh(float e);
34
35float exp(float e);
36float exp2(float e);
37float expm1(float e);
38
39vector frexp(float e); // returns mantissa as _x, exponent as _y
40int ilogb(float e);
41float ldexp(float e, int e);
42//float log(float e);
43float logn(float e, float base);
44float log10(float e);
45float log1p(float e);
46float log2(float e);
47float logb(float e);
48vector modf(float f); // fraction as _x, integer as _y
49
50float scalbn(float e, int n);
51
52float cbrt(float e);
53//float fabs(float e);
54float hypot(float e, float f);
55//float pow(float e, float f);
56//float sqrt(float e, float f);
57
58float erf(float e);
59float erfc(float e);
60vector lgamma(float e); // value in _x, sign in _y
61float tgamma(float e);
62
72float pymod(float e, float f);
73
74//float ceil(float e);
75//float floor(float e);
76float nearbyint(float e);
77//float rint(float e);
78//float round(float e);
79float trunc(float e);
80
81float fmod(float e, float f);
82float remainder(float e, float f);
83vector remquo(float e, float f);
84
85float copysign(float e, float f);
86float nan(string tag);
87float nextafter(float e, float f);
88float nexttoward(float e, float f);
89
90float fdim(float e, float f);
91float fmax(float e, float f);
92float fmin(float e, float f);
93float fma(float e, float f, float g);
94
95int isgreater(float e, float f);
96int isgreaterequal(float e, float f);
97int isless(float e, float f);
98int islessequal(float e, float f);
99int islessgreater(float e, float f);
100int isunordered(float e, float f);
101
102const float M_E = 2.7182818284590452354; /* e */
103const float M_LOG2E = 1.4426950408889634074; /* log_2 e */
104const float M_LOG10E = 0.43429448190325182765; /* log_10 e */
105const float M_LN2 = 0.69314718055994530942; /* log_e 2 */
106const float M_LN10 = 2.30258509299404568402; /* log_e 10 */
107// -Wdouble-declaration
108#define M_PI 3.14159265358979323846 /* pi */
109const float M_PI_2 = 1.57079632679489661923; /* pi/2 */
110const float M_PI_4 = 0.78539816339744830962; /* pi/4 */
111const float M_1_PI = 0.31830988618379067154; /* 1/pi */
112const float M_2_PI = 0.63661977236758134308; /* 2/pi */
113const float M_2_SQRTPI = 1.12837916709551257390; /* 2/sqrt(pi) */
114const float M_SQRT2 = 1.41421356237309504880; /* sqrt(2) */
115const float M_SQRT1_2 = 0.70710678118654752440; /* 1/sqrt(2) */
float trunc(float e)
Definition mathlib.qc:203
const float M_PI_2
Definition mathlib.qh:109
float erf(float e)
Definition mathlib.qc:141
const float M_LN2
Definition mathlib.qh:105
float fdim(float e, float f)
Definition mathlib.qc:260
const float M_2_PI
Definition mathlib.qh:112
bool signbit(float e)
Definition mathlib.qc:43
int ilogb(float e)
Definition mathlib.qc:94
const float M_SQRT1_2
Definition mathlib.qh:115
bool isinf(float e)
Definition mathlib.qc:21
float erfc(float e)
Definition mathlib.qc:148
int isgreater(float e, float f)
Definition mathlib.qc:277
float log2(float e)
Definition mathlib.qc:114
const float M_LN10
Definition mathlib.qh:106
const float M_E
Definition mathlib.qh:102
vector remquo(float e, float f)
Definition mathlib.qc:216
float ldexp(float e, int e)
Definition mathlib.qc:98
float nan(string tag)
Definition mathlib.qc:230
float fmin(float e, float f)
Definition mathlib.qc:268
float fmax(float e, float f)
Definition mathlib.qc:264
float exp2(float e)
Definition mathlib.qc:77
float expm1(float e)
Definition mathlib.qc:81
const float M_LOG10E
Definition mathlib.qh:104
const int FP_NAN
Definition mathlib.qh:8
float cbrt(float e)
Definition mathlib.qc:132
const float M_2_SQRTPI
Definition mathlib.qh:113
float log1p(float e)
Definition mathlib.qc:110
float sinh(float e)
Definition mathlib.qc:64
const float M_1_PI
Definition mathlib.qh:111
float remainder(float e, float f)
Definition mathlib.qc:212
vector lgamma(float e)
Definition mathlib.qc:152
float exp(float e)
Definition mathlib.qc:73
bool isnormal(float e)
Definition mathlib.qc:39
float hypot(float e, float f)
Definition mathlib.qc:136
float nextafter(float e, float f)
Definition mathlib.qc:234
float cosh(float e)
Definition mathlib.qc:60
float log10(float e)
Definition mathlib.qc:106
float copysign(float e, float f)
Definition mathlib.qc:225
float tanh(float e)
Definition mathlib.qc:68
const float M_SQRT2
Definition mathlib.qh:114
int islessequal(float e, float f)
Definition mathlib.qc:289
int isunordered(float e, float f)
Definition mathlib.qc:297
float logn(float e, float base)
Definition mathlib.qc:102
const int FP_NORMAL
Definition mathlib.qh:12
const int FP_INFINITE
Definition mathlib.qh:9
float logb(float e)
Definition mathlib.qc:118
float atanh(float e)
Definition mathlib.qc:56
vector frexp(float e)
Definition mathlib.qc:86
float tgamma(float e)
Definition mathlib.qc:179
const float M_PI_4
Definition mathlib.qh:110
float nearbyint(float e)
Definition mathlib.qc:199
bool isfinite(float e)
Definition mathlib.qc:17
int isgreaterequal(float e, float f)
Definition mathlib.qc:281
float scalbn(float e, int n)
Definition mathlib.qc:127
vector modf(float f)
Definition mathlib.qc:122
float fmod(float e, float f)
Definition mathlib.qc:208
int fpclassify(float e)
Definition mathlib.qc:7
const float M_LOG2E
Definition mathlib.qh:103
float asinh(float e)
Definition mathlib.qc:52
const int FP_SUBNORMAL
Definition mathlib.qh:11
float acosh(float e)
Definition mathlib.qc:48
const int FP_ZERO
Definition mathlib.qh:10
int islessgreater(float e, float f)
Definition mathlib.qc:293
int isless(float e, float f)
Definition mathlib.qc:285
float pymod(float e, float f)
Pythonic mod: TODO: %% operator?
Definition mathlib.qc:194
bool isnan(float e)
Definition mathlib.qc:25
float fma(float e, float f, float g)
Definition mathlib.qc:272
float nexttoward(float e, float f)
Definition mathlib.qc:255
vector
Definition self.qh:92