From 3979dd9d09801792e8cc4428c4cf80ec98c676a3 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 22 Mar 2012 18:27:07 -0700 Subject: * arith.c (expo): New function. * eval.c (eval_init): expo registered as intrinsic exp. * lib.h (expo): Declared. * txr.1: Added to stub heading. * txr.vim: Highlighting for exp. --- ChangeLog | 12 ++++++++++++ arith.c | 5 +++++ eval.c | 1 + lib.h | 1 + txr.1 | 2 +- txr.vim | 2 +- 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c9be325..92dcb1b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2012-03-22 Kaz Kylheku + + * arith.c (expo): New function. + + * eval.c (eval_init): expo registered as intrinsic exp. + + * lib.h (expo): Declared. + + * txr.1: Added to stub heading. + + * txr.vim: Highlighting for exp. + 2012-03-22 Kaz Kylheku * eval.c (transform_op): use integerp instead of numberp. diff --git a/arith.c b/arith.c index 27ac3faf..4ee87055 100644 --- a/arith.c +++ b/arith.c @@ -1319,6 +1319,11 @@ val loga(val num) return flo(log(c_flo(to_float(lit("log"), num)))); } +val expo(val num) +{ + return flo(exp(c_flo(to_float(lit("exp"), num)))); +} + val sqroot(val num) { return flo(sqrt(c_flo(to_float(lit("sqrt"), num)))); diff --git a/eval.c b/eval.c index 21397f1f..fbe63d3a 100644 --- a/eval.c +++ b/eval.c @@ -2193,6 +2193,7 @@ void eval_init(void) reg_fun(intern(lit("cos"), user_package), func_n1(cosi)); reg_fun(intern(lit("atan"), user_package), func_n1(atang)); reg_fun(intern(lit("log"), user_package), func_n1(loga)); + reg_fun(intern(lit("exp"), user_package), func_n1(expo)); reg_fun(intern(lit("sqrt"), user_package), func_n1(sqroot)); reg_fun(intern(lit("fixnump"), user_package), func_n1(fixnump)); reg_fun(intern(lit("bignump"), user_package), func_n1(bignump)); diff --git a/lib.h b/lib.h index 9876d77f..7c197e0a 100644 --- a/lib.h +++ b/lib.h @@ -433,6 +433,7 @@ val sine(val); val cosi(val); val atang(val); val loga(val); +val expo(val); val string_own(wchar_t *str); val string(const wchar_t *str); val string_utf8(const char *str); diff --git a/txr.1 b/txr.1 index 9a8e4d80..af743a4b 100644 --- a/txr.1 +++ b/txr.1 @@ -6649,7 +6649,7 @@ Certain object types have a custom equal function. .SS Arithmetic function abs -.SS Arithmetic functions floor, ceil, sin, cos, atan, log +.SS Arithmetic functions floor, ceil, sin, cos, atan, log, exp .SS Arithmetic functions expt, sqrt, isqrt diff --git a/txr.vim b/txr.vim index c219d01a..88313eb8 100644 --- a/txr.vim +++ b/txr.vim @@ -44,7 +44,7 @@ syn keyword txl_keyword contained memq memql memqual tree-find some syn keyword txl_keyword contained remq remql remqual syn keyword txl_keyword contained all none eq eql equal + - * / abs trunc mod syn keyword txl_keyword contained expt exptmod sqrt isqrt gcd -syn keyword txl_keyword contained floor ceil sin cos atan log +syn keyword txl_keyword contained floor ceil sin cos atan log exp syn keyword txl_keyword contained fixnump bignump integerp floatp syn keyword txl_keyword contained numberp zerop evenp oddp > syn keyword txl_keyword contained zerop evenp oddp > < >= <= max min -- cgit v1.2.3