summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-09-06 22:02:04 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-09-06 22:02:04 -0700
commiteb8344963b2606cff7ba2ebaa1eafd6ec0b6766e (patch)
treec8320cf8ac87156f65defe6ade1e67a08db8c16d
parented68b9870b11007c9d1facb2a95caa801eb34f27 (diff)
downloadtxr-eb8344963b2606cff7ba2ebaa1eafd6ec0b6766e.tar.gz
txr-eb8344963b2606cff7ba2ebaa1eafd6ec0b6766e.tar.bz2
txr-eb8344963b2606cff7ba2ebaa1eafd6ec0b6766e.zip
digits/digpow: wrong results for radix powers.
* arith.c (digcommon): Fix off-by-one test causing incorrect results for radix powers like (digits 10) (digits 100) ... and analogously in other radices. Reported by vapnik spaknik.
-rw-r--r--arith.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arith.c b/arith.c
index e9fd0185..6079e15f 100644
--- a/arith.c
+++ b/arith.c
@@ -3732,7 +3732,7 @@ static val digcommon(int pow, val self, val n, val base_in)
val p = nil, p0;
list_collect_decl (out, ptail);
- while (lt(k, n)) {
+ while (le(k, n)) {
push(k, &p);
k = mul(k, r);
}