summaryrefslogtreecommitdiffstats
path: root/arith.c
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.c
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.c')
-rw-r--r--arith.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/arith.c b/arith.c
index 85a0f346..5c59af23 100644
--- a/arith.c
+++ b/arith.c
@@ -74,16 +74,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);
}
}