summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
Diffstat (limited to 'math.c')
-rw-r--r--math.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/math.c b/math.c
index fe28ef1..71afabc 100644
--- a/math.c
+++ b/math.c
@@ -112,6 +112,16 @@ static i64 mod_i64(i64 a, i64 b) {
return ret;
}
+static i64 abs_i64(i64 x) {
+ return x < 0 ? -x : +x;
+}
+
+static i64 sgn_i64(i64 x) {
+ if (x < 0) return -1;
+ if (x > 0) return +1;
+ return 0;
+}
+
static float sgnf(float x) {
if (x < 0) return -1;
if (x > 0) return +1;