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
commit337e47fb140beea69af30d3e8f84307ee244afb4 (patch)
treec8320cf8ac87156f65defe6ade1e67a08db8c16d
parent75350e11c3a5768df7dd5d88b7147c92b3f99380 (diff)
downloadtxr-337e47fb140beea69af30d3e8f84307ee244afb4.tar.gz
txr-337e47fb140beea69af30d3e8f84307ee244afb4.tar.bz2
txr-337e47fb140beea69af30d3e8f84307ee244afb4.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);
}