From eb8344963b2606cff7ba2ebaa1eafd6ec0b6766e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 6 Sep 2019 22:02:04 -0700 Subject: 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. --- arith.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } -- cgit v1.2.3