diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-03-29 21:41:49 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-03-29 21:41:49 -0700 |
commit | 8b8ca2e793f90aa58d7430b8f060c467cd41ec1b (patch) | |
tree | 322203f975cfb3b66c67252791bb0ba987253923 /lib.c | |
parent | 2b1e05769d01cb036cf0a82231eb87b698a33426 (diff) | |
download | txr-8b8ca2e793f90aa58d7430b8f060c467cd41ec1b.tar.gz txr-8b8ca2e793f90aa58d7430b8f060c467cd41ec1b.tar.bz2 txr-8b8ca2e793f90aa58d7430b8f060c467cd41ec1b.zip |
* arith.c (numeq): New function.
(exptmod): Bugfix: was no normalizing the bignum, ouch.
Also was reporting "non-integral operands" for other
errors.
* eval.c (eval_init): Registered = intrinsic function.
* lib.c (numeqv): New function.
* lib.h (numeq, numeqv): Declared.
* txr.1: Documented expt, sqrt, isqrt, exptmod, fixnump, bignump,
integerp, floatp, numberp, zerop, evenp, oddp, >, <, >=, <= and =.
* txr.vim: Highlight =
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -1269,6 +1269,20 @@ val lev(val first, val rest) return t; } +val numeqv(val first, val rest) +{ + val iter; + + for (iter = rest; iter; iter = cdr(iter)) { + val elem = car(iter); + if (!numeq(first, elem)) + return nil; + first = elem; + } + + return t; +} + val max2(val anum, val bnum) { return if3(gt(anum, bnum), anum, bnum); |