Integer ndigit method isn't so hot at the low end.  Remarkably, the low end is 
pretty high!

sage: n=2^500
sage: %timeit len(n.digits(10))
10000 loops, best of 3: 61.6 µs per loop
sage: %timeit n.ndigits(10)
10000 loops, best of 3: 98.4 µs per loop
sage: len(n.digits(10))==n.ndigits(10)
True
sage: n.ndigits(10)
151

In a similar vein, I observe that the fancy algorithm I implemented for 
http://trac.sagemath.org/sage_trac/ticket/2362
and 
http://trac.sagemath.org/sage_trac/ticket/2170
also seems to be badly beaten on the low end by simple repeated divisions.   I 
welcome comments about that because I think the divide & conquer algorithm 
should be winning easily before 2000 bits.

--
Joel

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to