summaryrefslogtreecommitdiffstats
path: root/arith.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-10-16 18:44:52 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-10-16 18:44:52 -0700
commitb2dfc50f1c98417166d647538d7d5ecd6178dd4c (patch)
treea60accd6d167928c824bc639517337b6a66ec688 /arith.c
parentbb043799e946ad141d3012fdd5b247dfa812efc5 (diff)
downloadtxr-b2dfc50f1c98417166d647538d7d5ecd6178dd4c.tar.gz
txr-b2dfc50f1c98417166d647538d7d5ecd6178dd4c.tar.bz2
txr-b2dfc50f1c98417166d647538d7d5ecd6178dd4c.zip
* arith.c (gcd, lognot): Bugfix: bignum results
in fixnum range not normalized.
Diffstat (limited to 'arith.c')
-rw-r--r--arith.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arith.c b/arith.c
index d107afbb..76066d63 100644
--- a/arith.c
+++ b/arith.c
@@ -1389,7 +1389,7 @@ val gcd(val anum, val bnum)
if (mp_gcd(mp(anum), mp(bnum), mp(n)) != MP_OKAY)
goto bad;
- return n;
+ return normalize(n);
inval:
uw_throwf(error_s, lit("gcd: non-integral operands ~s ~s"),
anum, bnum, nao);
@@ -1753,7 +1753,7 @@ val lognot(val a, val bits)
b = make_bignum();
if (mp_comp(mp(a), mp(b)) != MP_OKAY)
goto bad;
- return b;
+ return normalize(b);
default:
uw_throwf(error_s, lit("lognot: non-integral operand ~s"), a, nao);
}