Bill Allombert on Mon, 23 Oct 2023 19:29:49 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

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


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