From 56206232e42f9a69715f6ea2163abf7cae3e2e05 Mon Sep 17 00:00:00 2001 From: Shawon Dey Date: Sat, 11 Jul 2026 14:10:03 +0600 Subject: [PATCH 1/3] Add log2 and log10 functions for logarithmic calculations --- lib/math.eigs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/math.eigs b/lib/math.eigs index 2457528..20cd035 100644 --- a/lib/math.eigs +++ b/lib/math.eigs @@ -135,3 +135,12 @@ define argmin(items) as: best_val is items[i] best_idx is i return best_idx + +# ---- log2: base-2 logarithm ---- +define log2(x) as: + return (log of x) / 0.6931471805599453 + +# ---- log10: base-10 logarithm ---- +define log10(x) as: + return (log of x) / 2.302585092994046 + From 19ec6f90be8cac02ac70c0b7ad7936dc0e65e0c4 Mon Sep 17 00:00:00 2001 From: Shawon Dey Date: Sat, 11 Jul 2026 14:20:00 +0600 Subject: [PATCH 2/3] Add log2 and log10 functions to STDLIB documentation --- docs/STDLIB.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/STDLIB.md b/docs/STDLIB.md index 9ab99b3..a337013 100644 --- a/docs/STDLIB.md +++ b/docs/STDLIB.md @@ -58,7 +58,8 @@ signature comment above each function (e.g., `# clamp of [value, lo, hi]`). | `lcm` | `lcm of [a, b]` | Least common multiple | | `argmax` | `argmax of list` | Index of the largest element (first on ties, -1 if empty) | | `argmin` | `argmin of list` | Index of the smallest element (first on ties, -1 if empty) | - +| `log2` | `log2 of x` | base-2 logarithm | +| `log10` | `log10 of x` | base-10 logarithm | ### lib/list.eigs — Functional List Operations | Function | Signature | Description | From 0a833379bfcbe4f77f2c738086ff1839fbe23704 Mon Sep 17 00:00:00 2001 From: Shawon Dey Date: Sat, 11 Jul 2026 18:33:51 +0600 Subject: [PATCH 3/3] Fix formatting in BUILTINS.md for borrow guard selftest --- docs/BUILTINS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/BUILTINS.md b/docs/BUILTINS.md index 376f5e5..ba9dc64 100644 --- a/docs/BUILTINS.md +++ b/docs/BUILTINS.md @@ -618,4 +618,4 @@ receiver. | Name | Signature | Description | |------|-----------|-------------| -| `__borrow_guard_selftest` | `__borrow_guard_selftest of [args...]` | **Not a user builtin.** A planted fault validating the #548 borrow-scan guard: registered only in ASan builds when `EIGS_BORROW_GUARD_SELFTEST` is set, it deliberately returns a borrowed direct child past `VM_BORROW_SCAN_CAP` so the suite can prove the guard aborts loudly (naming the builtin) instead of letting a missed compensating incref become a silent use-after-free. Absent from release builds and from sanitizer builds without the opt-in env var (fuzzers must never reach a deliberate abort). | +| `__borrow_guard_selftest` | `__borrow_guard_selftest of [args...]` | **Not a user builtin.** A planted fault validating the #548 borrow-scan guard: registered only in ASan builds when `EIGS_BORROW_GUARD_SELFTEST` is set, it deliberately returns a borrowed direct child past `VM_BORROW_SCAN_CAP` so the suite can prove the guard aborts loudly (naming the builtin) instead of letting a missed compensating incref become a silent use-after-free. Absent from release builds and from sanitizer builds without the opt-in env var (fuzzers must never reach a deliberate abort). |