ANN: BigDecimal - decimal arithmetic on very large intergers

casevh at comcast.net casevh at comcast.net
Mon Mar 28 01:40:07 CEST 2005


BigDecimal is a Python class that supports decimal arithmetic on very large integers. BigDecimal was inspired by the posting of BigDec to c.l.py by Tim Peters. BigDecimal implements all the commonly used integer methods. (It doesn't implement any of the binary/shifting operations.) 

It has been optimized for performance. It uses a 4x4 Toom-Cook algorithm for multiplication and a new, very fast, division algorithm. If GMPY is available, it will be automatically used.

Performance examples, computing the decimal represendation of the 42nd Mersenne prime:
    2**25964951 - 1

Tim Peter's posting to c.l.py: 13 minutes 41 seconds
BigDecimal: 59 seconds
BigDecimal w/gmpy: 10 seconds

The first released version is availabe at http://home.comcast.net/~casevh


More information about the Python-announce-list mailing list