From 83daa51dd5eec95c7f1543eef69d52587e35bee8 Mon Sep 17 00:00:00 2001 From: Larry Frieson Date: Tue, 9 Apr 2024 17:59:01 -0700 Subject: [PATCH] Add math.min function support to csnex --- exec/csnex/lib/math.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/exec/csnex/lib/math.cs b/exec/csnex/lib/math.cs index d2d5b9147..d21919cc6 100644 --- a/exec/csnex/lib/math.cs +++ b/exec/csnex/lib/math.cs @@ -59,6 +59,17 @@ public void log() Exec.stack.Push(Cell.CreateNumberCell(Number.FromDouble(r))); } + public void min() + { + Number b = Exec.stack.Pop().Number; + Number a = Exec.stack.Pop().Number; + if (Number.IsGreaterThan(a, b)) { + Exec.stack.Push(Cell.CreateNumberCell(b)); + } else { + Exec.stack.Push(Cell.CreateNumberCell(a)); + } + } + public void sign() { Number x = Exec.stack.Pop().Number;