Re: sumdigits(n,B) doesn't refuse B < -1

Bill Allombert <[email protected]>
Newsgroups gmane.comp.mathematics.pari.devel
Message-ID <ZTathoPsI4C8LAx1@seventeen>
On Tue, Oct 17, 2023 at 09:29:59AM +0200, Ruud H.G. van Tol wrote:
> ? sumdigits(12345,-4)
> % 5
> 
> Expected:
> 
>   ***   at top-level: sumdigits(12345,-4)
>   ***                 ^------------------
>   *** sumdigits: domain error in digits: B < 2
>   ***   Break loop: type 'break' to go back to GP prompt

Hello Ruud,

I have changed GP so that now:

? digits(12345,-4)
%2 = [3,0,1,3,0,2,1]
? sumdigits(12345,-4)
%3 = 10

which fixes this discrepancy!

Thanks for reporting this problem!
Bill
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.