Bill Allombert on Wed, 04 Dec 2013 00:03:38 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: reverse of digits() |
On Tue, Dec 03, 2013 at 05:40:21PM -0500, Charles Greathouse wrote: > I see convi here: > > GEN > sumdigits(GEN n) > { > pari_sp av = avma; > ulong s, *res; > long l; > > if (typ(n) != t_INT) pari_err_TYPE("sumdigits", n); > l = lgefint(n); > switch(l) > { > case 2: return gen_0; > case 3: return utoipos(sumdigitsu(n[2])); > } > res = convi(n, &l); > > in the git HEAD. Then it is worse than what I imagined: the only reason sumdigits is faster than digits is that it use convi which use mpn_get_str which only works for basis <=256. Cheers, Bill.