ANN: DecInt 0.3 - Arithmetic for very large decimal integers
casevh@comcast.net
casevh at comcast.net
Wed Nov 30 08:51:27 CET 2005
DecInt is a class that support arithmetic on very large decimal
integers.
For example, it can calculate the decimal form of the 42nd Mersenne
prime, all 7,816,230 digits, in less than 21 seconds. And less than 6
seconds if gmpy 1.01 is available.
This version is significantly faster than the prior version.
Multiplication used a combination of 4-way Toom-Cook and Nussbaumer
convolution. Pure Python multiplication is less than 10x slower than
GMP's hand optimised assembler code!
Division uses a new algorithm based on David M. Smith's division
algorithm. Pure Python division is 16x slower than GMP but can actually
be faster in some instances; for example, dividing a 2,000,000 digit
number by an 800,000 digit number.
DecInt can be found at http://home.comcast.net/~casevh/
(DecInt used to be called BigDecimal; I renamed it to avoid confusion
with the "decimal" class include with Python.)
Enjoy,
casevh
More information about the Python-announce-list
mailing list