summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--arith.c12
2 files changed, 11 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index f4f4efde..2c70a4e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-03-20 Kaz Kylheku <kaz@kylheku.com>
+ * arith.c (plus): Completed implementation of bignum-float
+ and float-bignum cases.
+
+2012-03-20 Kaz Kylheku <kaz@kylheku.com>
+
* stream.c (vformat): Use larger num_buf buffer so we don't
overrun. IEEE double floats can go to e+-308.
diff --git a/arith.c b/arith.c
index 769da0d0..09529b43 100644
--- a/arith.c
+++ b/arith.c
@@ -259,10 +259,8 @@ int highest_bit(int_ptr_t n)
val plus(val anum, val bnum)
{
- int tag_a = tag(anum);
- int tag_b = tag(bnum);
-
- switch (TAG_PAIR(tag_a, tag_b)) {
+tail:
+ switch (TAG_PAIR(tag(anum), tag(bnum))) {
case TAG_PAIR(TAG_NUM, TAG_NUM):
{
cnum a = c_num(anum);
@@ -352,9 +350,11 @@ val plus(val anum, val bnum)
return flo(c_flo(anum) + c_flo(bnum));
}
case TYPE_PAIR(BGNUM, FLNUM):
+ anum = flo_int(anum);
+ goto tail;
case TYPE_PAIR(FLNUM, BGNUM):
- uw_throwf(error_s, lit("plus: unimplemented bignum float combo ~s ~s"),
- anum, bnum, nao);
+ bnum = flo_int(bnum);
+ goto tail;
default:
break;
}