Bill Allombert on Tue, 07 Jun 2016 15:24:13 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Regarding digits(999999999999999,4294967295) result. |
On Tue, Jun 07, 2016 at 02:11:38PM +0530, chandra sekaran wrote: > gp > digits(999999999999999,4294967295) > > [232830, -1530262147] > > Is it correct? No. > I think answer should be [232830, 2764705149]. Am i correct Yes, you are correct. Internally digits are computed as unsigned C integer, but unfortunately they are converted to signed pari integers. The patch below fix that. Thanks for reporting this bug! Cheers, Bill. index 4157b12..b647e1e 100644 --- a/src/basemath/arith2.c +++ b/src/basemath/arith2.c @@ -1482,7 +1482,7 @@ digits(GEN x, GEN B) (void)new_chunk(3*lz); /* HACK */ z = zero_zv(lz); digits_dacsmall(x,vB,lz,(ulong*)(z+1)); - avma = av; return vecsmall_to_vec(z); + avma = av; return Flv_to_ZV(z); } }