#ifndef MATHLIB_H
#define MATHLIB_H
-#if defined(CSQC)
- #include "../common/util-pre.qh"
- #include "../client/sys-pre.qh"
- #include "../dpdefs/csprogsdefs.qh"
- #include "../client/sys-post.qh"
- #include "../client/defs.qh"
- #include "../dpdefs/keycodes.qh"
- #include "../common/constants.qh"
- #include "../common/stats.qh"
- #include "anglestransform.qh"
-#elif defined(MENUQC)
- #include "../common/util-pre.qh"
- #include "../menu/sys-pre.qh"
- #include "../dpdefs/menudefs.qh"
- #include "../dpdefs/keycodes.qh"
- #include "../menu/sys-post.qh"
- #include "../menu/config.qh"
-#elif defined(SVQC)
- #include "../common/util-pre.qh"
- #include "../server/sys-pre.qh"
- #include "../dpdefs/progsdefs.qh"
- #include "../dpdefs/dpextensions.qh"
- #include "../server/sys-post.qh"
- #include "anglestransform.qh"
-#endif
-
// <math.h>
// 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);
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);
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