about summary refs log tree commit diff stats
path: root/506math.mu
diff options
context:
space:
mode:
Diffstat (limited to '506math.mu')
-rw-r--r--506math.mu21
1 files changed, 21 insertions, 0 deletions
diff --git a/506math.mu b/506math.mu
new file mode 100644
index 00000000..d4e4194c
--- /dev/null
+++ b/506math.mu
@@ -0,0 +1,21 @@
+fn abs n: int -> _/eax: int {
+  compare n, 0
+  {
+    break-if->=
+    negate n
+  }
+  return n
+}
+
+fn sgn n: int -> _/eax: int {
+  compare n, 0
+  {
+    break-if-<=
+    return 1
+  }
+  {
+    break-if->=
+    return -1
+  }
+  return 0
+}