~ft/public-inbox

femtolisp: pow log2 and log10 v1 PROPOSED

mag: 1
 pow log2 and log10

 1 files changed, 8 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~ft/public-inbox/patches/40664/mbox | git am -3
Learn more about email & git

[PATCH femtolisp] pow log2 and log10 Export this patch

---
I did this primarly because I noticed the lack of an "expt" function in the lang (..then I also added log2 and log10).
Don't know if this is the correct way to do it nor if I'm missing something. Thanks!

 builtins.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/builtins.c b/builtins.c
index 8a34db6..1454605 100644
--- a/builtins.c
@@ -419,9 +419,17 @@ BUILTIN("rand.float", rand_float)
		return mk_double(cname(todouble(args[0]))); \
	}

BUILTIN("pow", pow)
{
	argcount(nargs, 2);
	return mk_double(pow(todouble(args[0]), todouble(args[1])));
}

BUILTIN_("sqrt", sqrt)
BUILTIN_("exp", exp)
BUILTIN_("log", log)
BUILTIN_("log10", log10)
BUILTIN_("log2", log2)
BUILTIN_("sin", sin)
BUILTIN_("cos", cos)
BUILTIN_("tan", tan)
-- 
2.40.0