Skip to content

Commit

Permalink
Add math.min function support to csnex
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlarryf committed Apr 10, 2024
1 parent 9ae5c25 commit 83daa51
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions exec/csnex/lib/math.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 83daa51

Please sign in to comment.