summaryrefslogtreecommitdiffstats
path: root/arith.txr
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-12-11 09:50:51 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-12-11 09:50:51 -0800
commit229a5ca3c4cfe533407567de2c745d26a306d391 (patch)
treef84b3b1062d7b5c2337453b2c164ad3731cba048 /arith.txr
parentf26de1fd4d708349dfaa59944e85290e0fb75c81 (diff)
downloadtxr-229a5ca3c4cfe533407567de2c745d26a306d391.tar.gz
txr-229a5ca3c4cfe533407567de2c745d26a306d391.tar.bz2
txr-229a5ca3c4cfe533407567de2c745d26a306d391.zip
* arith.c: Regenerated.
* arith.txr (normalize): Bugfix: was not turning +/- NUM_MAX bignums into fixnums.
Diffstat (limited to 'arith.txr')
-rw-r--r--arith.txr14
1 files changed, 5 insertions, 9 deletions
diff --git a/arith.txr b/arith.txr
index 736645da..cba98be2 100644
--- a/arith.txr
+++ b/arith.txr
@@ -79,16 +79,12 @@ static val bignum_dbl_ipt(double_intptr_t di)
static val normalize(val bignum)
{
- switch (mp_cmp_mag(mp(bignum), &NUM_MAX_MP)) {
- case MP_EQ:
- case MP_GT:
+ if (mp_cmp_mag(mp(bignum), &NUM_MAX_MP) == MP_GT) {
return bignum;
- default:
- {
- cnum fixnum;
- mp_get_intptr(mp(bignum), &fixnum);
- return num(fixnum);
- }
+ } else {
+ cnum fixnum;
+ mp_get_intptr(mp(bignum), &fixnum);
+ return num(fixnum);
}
}