summaryrefslogtreecommitdiffstats
path: root/arith.c
diff options
context:
space:
mode:
Diffstat (limited to 'arith.c')
-rw-r--r--arith.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/arith.c b/arith.c
index 084d8cf5..67fa75c2 100644
--- a/arith.c
+++ b/arith.c
@@ -1557,6 +1557,28 @@ val zerop(val num)
}
}
+val nzerop(val num)
+{
+ val self = lit("nzerop");
+
+ if (num == zero)
+ return nil;
+
+ switch (type(num)) {
+ case NUM:
+ case BGNUM:
+ return t;
+ case FLNUM:
+ return tnil(c_flo(num, self) != 0.0);
+ case CHR:
+ return tnil(num != chr(0));
+ case RNG:
+ return tnil(nzerop(from(num)) || nzerop(to(num)));
+ default:
+ not_number(self, num);
+ }
+}
+
val plusp(val num)
{
val self = lit("plusp");