summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-03-22 18:27:07 -0700
committerKaz Kylheku <kaz@kylheku.com>2012-03-22 18:27:07 -0700
commit3979dd9d09801792e8cc4428c4cf80ec98c676a3 (patch)
tree9392492eca5f107e85919914e05ff59b064d5f5f
parent3e43fc5cd22e5293aef97cc67721d12fff9b9a84 (diff)
downloadtxr-3979dd9d09801792e8cc4428c4cf80ec98c676a3.tar.gz
txr-3979dd9d09801792e8cc4428c4cf80ec98c676a3.tar.bz2
txr-3979dd9d09801792e8cc4428c4cf80ec98c676a3.zip
* 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.
-rw-r--r--ChangeLog12
-rw-r--r--arith.c5
-rw-r--r--eval.c1
-rw-r--r--lib.h1
-rw-r--r--txr.12
-rw-r--r--txr.vim2
6 files changed, 21 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3c9be325..92dcb1b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2012-03-22 Kaz Kylheku <kaz@kylheku.com>
+ * 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 <kaz@kylheku.com>
+
* eval.c (transform_op): use integerp instead of numberp.
Not all numbers are integers now, and that situation
requires an integer.
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