2 Copyright (c) 2009 Rudolf Polzer
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in
6 the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 of the Software, and to permit persons to whom the Software is furnished to do
9 so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 // The commented-out functions need no implementation because DarkPlaces offers
26 // them as builtins. They are listed here anyway for completeness sake.
33 #define FP_SUBNORMAL 3
35 int fpclassify(float x);
36 int isfinite(float x);
39 int isnormal(float x);
42 //float acos(float x);
43 //float asin(float x);
44 //float atan(float x);
45 //float atan2(float y, float x);
61 vector frexp(float x); // returns mantissa as _x, exponent as _y
63 float ldexp(float x, int e);
69 vector modf(float f); // fraction as _x, integer as _y
71 float scalbn(float x, int n);
74 //float fabs(float x);
75 float hypot(float x, float y);
76 //float pow(float x, float y);
77 //float sqrt(float x, float y);
81 vector lgamma(float x); // value in _x, sign in _y
82 float tgamma(float x);
84 //float ceil(float x);
85 //float floor(float x);
86 float nearbyint(float x);
87 //float rint(float x);
88 //float round(float x);
91 float fmod(float x, float y);
92 float remainder(float x, float y);
93 vector remquo(float x, float y);
95 float copysign(float x, float y);
96 float nan(string tag);
97 float nextafter(float x, float y);
98 float nexttoward(float x, float y);
100 float fdim(float x, float y);
101 float fmax(float x, float y);
102 float fmin(float x, float y);
103 float fma(float x, float y, float z);
105 int isgreater(float x, float y);
106 int isgreaterequal(float x, float y);
107 int isless(float x, float y);
108 int islessequal(float x, float y);
109 int islessgreater(float x, float y);
110 int isunordered(float x, float y);
112 #define M_E 2.7182818284590452354 /* e */
113 #define M_LOG2E 1.4426950408889634074 /* log_2 e */
114 #define M_LOG10E 0.43429448190325182765 /* log_10 e */
115 #define M_LN2 0.69314718055994530942 /* log_e 2 */
116 #define M_LN10 2.30258509299404568402 /* log_e 10 */
117 #define M_PI 3.14159265358979323846 /* pi */
118 #define M_PI_2 1.57079632679489661923 /* pi/2 */
119 #define M_PI_4 0.78539816339744830962 /* pi/4 */
120 #define M_1_PI 0.31830988618379067154 /* 1/pi */
121 #define M_2_PI 0.63661977236758134308 /* 2/pi */
122 #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
123 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
124 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */