about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--apps/tile/environment.mu2
-rw-r--r--apps/tile/rpn.mu20
2 files changed, 21 insertions, 1 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu
index 4ebd41d2..6d6b91ec 100644
--- a/apps/tile/environment.mu
+++ b/apps/tile/environment.mu
@@ -1517,7 +1517,7 @@ fn render-primitives screen: (addr screen), bottom-margin-row: int, right-col: i
   row <- subtract 1
   var col/edx: int <- copy 1
   move-cursor screen, row, col
-  row, col <- render-primitive-group screen, row, col, right-col, "numbers: ", "+ - *  "
+  row, col <- render-primitive-group screen, row, col, right-col, "numbers: ", "+ - * / sqrt  "
   row, col <- render-primitive-group screen, row, col, right-col, "arrays: ", "len  "
   row, col <- render-primitive-group screen, row, col, right-col, "files: ", "open read slurp lines  "
   row, col <- render-primitive-group screen, row, col, right-col, "misc: ", "dup swap  "  # hack: keep these at the right of the bottom row
diff --git a/apps/tile/rpn.mu b/apps/tile/rpn.mu
index 193bd2c9..219e9b09 100644
--- a/apps/tile/rpn.mu
+++ b/apps/tile/rpn.mu
@@ -50,6 +50,26 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch:
         push-number-to-value-stack out, a
         break $evaluate:process-word
       }
+      {
+        var is-div?/eax: boolean <- stream-data-equal? curr-stream, "/"
+        compare is-div?, 0
+        break-if-=
+        var _b/xmm0: float <- pop-number-from-value-stack out
+        var b/xmm1: float <- copy _b
+        var a/xmm0: float <- pop-number-from-value-stack out
+        a <- divide b
+        push-number-to-value-stack out, a
+        break $evaluate:process-word
+      }
+      {
+        var is-sqrt?/eax: boolean <- stream-data-equal? curr-stream, "sqrt"
+        compare is-sqrt?, 0
+        break-if-=
+        var a/xmm0: float <- pop-number-from-value-stack out
+        a <- square-root a
+        push-number-to-value-stack out, a
+        break $evaluate:process-word
+      }
       ## strings/arrays
       {
         var is-len?/eax: boolean <- stream-data-equal? curr-stream, "len"