From bc665592de673232748e12f189121ee5a8360b93 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 20 Mar 2012 22:11:27 -0700 Subject: * arith.c (plus): Completed implementation of bignum-float and float-bignum cases. --- ChangeLog | 5 +++++ arith.c | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index f4f4efde..2c70a4e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-03-20 Kaz Kylheku + + * arith.c (plus): Completed implementation of bignum-float + and float-bignum cases. + 2012-03-20 Kaz Kylheku * stream.c (vformat): Use larger num_buf buffer so we don't 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; } -- cgit v1.2.3