diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-12-13 17:36:08 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-12-13 17:36:08 -0800 |
commit | ef47dfe4fcb7c1be369ae83221386b9da6474a1e (patch) | |
tree | a2ac264811c80ad085eea5ea725b3bb6be8ba751 /lib.c | |
parent | 5d0f219ab35f9e214a063e968286ba01f4b54dbf (diff) | |
download | txr-ef47dfe4fcb7c1be369ae83221386b9da6474a1e.tar.gz txr-ef47dfe4fcb7c1be369ae83221386b9da6474a1e.tar.bz2 txr-ef47dfe4fcb7c1be369ae83221386b9da6474a1e.zip |
* arith.c (highest_bit): Linkage changed to static.
(abso, isqrt): New functions.
(isqrt_fixnum): New static function.
* eval.c (eval_init): Registered abs, sqrt and numberp instrinsics.
* lib.c (numberp): New function.
* lib.h (numberp, abso, isqrt): Declared.
* mpi-patches/series: New patch added.
* mpi-patches/faster-square-root: New patch added.
* txr.1: Documentation stubs for new functions.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -832,6 +832,20 @@ val bignump(val num) return (is_ptr(num) && type(num) == BGNUM) ? t : nil; } +val numberp(val num) +{ + switch (tag(num)) { + case TAG_NUM: + return t; + case TAG_PTR: + if (num->t.type == BGNUM) + return t; + /* fallthrough */ + default: + return nil; + } +} + val plusv(val nlist) { if (!nlist) |