This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jneb
Recipients jneb
Date 2016-02-01.10:28:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1454322513.41.0.794136944555.issue26256@psf.upfronthosting.co.za>
In-reply-to
Content
Inspired by the recently new discovered 49th Mersenne prime number I wrote a module to do high speed long/int to decimal conversion. I can now output the new Mersenne number in 18.5 minutes (instead of several hours) on my machine.
For numbers longer than about 100000 bits, this routine it is faster than str(number) thanks to the Karatsuba multiplication in CPython.
The module supports all number bases 2 through 36, and is written in pure python (both 2 and 3).
There is a simple way to save more time by reusing the conversion object (saving about half the time for later calls).
My suggestion is to incorporate this into some library, since Python still lacks a routine to convert to any number base. Ideally, it could be incorporated in the builtin str function, but this would need more work. 
When converting to C, it is recommended to optimize bases 4 and 32 the same way as oct, hex and bin do (which isn't easily accessible from Python).

Hope you like it. At least, it was a lot of fun to write...

Hope you like it.
History
Date User Action Args
2016-02-01 10:28:35jnebsetrecipients: + jneb
2016-02-01 10:28:33jnebsetmessageid: <1454322513.41.0.794136944555.issue26256@psf.upfronthosting.co.za>
2016-02-01 10:28:33jneblinkissue26256 messages
2016-02-01 10:28:32jnebcreate