python decimal library dmath.py v0.3 released

Stefan Krah stefan at bytereef.org
Tue Mar 4 16:35:48 EST 2014


[I found this via the python-ideas thread]

Wolfgang Maier <wolfgang.maier <at> biologie.uni-freiburg.de> writes:
> math.factorial is accurate and faster than your pure-Python function,
especially for large numbers.

It is slower for huge numbers than decimal if you use this
Python function:

http://www.bytereef.org/mpdecimal/quickstart.html#factorial-in-pure-python


Be sure to set MAX_EMAX and MIN_EMIN, that's missing in the example.


If you want to *see* all digits of a very large number, then decimal is
probably even faster than gmpy. See:

http://www.bytereef.org/mpdecimal/benchmarks.html#arbitrary-precision-libraries



Stefan Krah




More information about the Python-list mailing list