]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/warpzonelib/mathlib.qh
Merge branch 'master' into Mario/buff_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / warpzonelib / mathlib.qh
index 6d1e488dc8f121b81d15652c22a1dd4481d2984d..9e750f0a5e84ec2ff4f658c0266d2063e93b717d 100644 (file)
@@ -6,17 +6,17 @@
 // The commented-out functions need no implementation because DarkPlaces offers
 // them as builtins. They are listed here anyway for completeness sake.
 
-const float FP_NAN = 0;
-const float FP_INFINITE = 1;
-const float FP_ZERO = 2;
-const float FP_SUBNORMAL = 3;
-const float FP_NORMAL = 4;
+const int FP_NAN = 0;
+const int FP_INFINITE = 1;
+const int FP_ZERO = 2;
+const int FP_SUBNORMAL = 3;
+const int FP_NORMAL = 4;
 int fpclassify(float x);
-int isfinite(float x);
-int isinf(float x);
-int isnan(float x);
-int isnormal(float x);
-int signbit(float x);
+bool isfinite(float x);
+bool isinf(float x);
+bool isnan(float x);
+bool isnormal(float x);
+bool signbit(float x);
 
 //float acos(float x);
 //float asin(float x);
@@ -41,6 +41,7 @@ vector frexp(float x); // returns mantissa as _x, exponent as _y
 int ilogb(float x);
 float ldexp(float x, int e);
 //float log(float x);
+float logn(float x, float base);
 float log10(float x);
 float log1p(float x);
 float log2(float x);
@@ -60,6 +61,17 @@ float erfc(float x);
 vector lgamma(float x); // value in _x, sign in _y
 float tgamma(float x);
 
+/**
+ * Pythonic mod:
+ * TODO: %% operator?
+ *
+ *  1 %  2 ==  1
+ * -1 %  2 ==  1
+ *  1 % -2 == -1
+ * -1 % -2 == -1
+ */
+float pymod(float x, float y);
+
 //float ceil(float x);
 //float floor(float x);
 float nearbyint(float x);
@@ -101,4 +113,8 @@ const float M_2_PI     = 0.63661977236758134308;  /* 2/pi */
 const float M_2_SQRTPI = 1.12837916709551257390;  /* 2/sqrt(pi) */
 const float M_SQRT2    = 1.41421356237309504880;  /* sqrt(2) */
 const float M_SQRT1_2  = 0.70710678118654752440;  /* 1/sqrt(2) */
-#endif
\ No newline at end of file
+
+// Non-<math.h> stuff follows here.
+vector cross(vector a, vector b);
+
+#endif