diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-12-11 09:50:51 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-12-11 09:50:51 -0800 |
commit | 229a5ca3c4cfe533407567de2c745d26a306d391 (patch) | |
tree | f84b3b1062d7b5c2337453b2c164ad3731cba048 /arith.txr | |
parent | f26de1fd4d708349dfaa59944e85290e0fb75c81 (diff) | |
download | txr-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.txr | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -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); } } |