about presicion

Alex Martelli aleaxit at yahoo.com
Tue Aug 31 06:50:29 EDT 2004


Ali <alikakakhel3 at hotmail.com> wrote:
   ...
> ok but where can i download deciaml? waht about gmpy? which is better?

Decimal (for 2.3): file decimal.py from:
 http://cvs.sourceforge.net/viewcvs.py/python/python/dist/src/Lib/

With 2.4 it will come as part of the standard library.

gmpy: http://gmpy.sourceforge.net.\/


"Which is better" for _WHAT_ task?  If you need decimal arithmetic,
obviously Decimal, since gmpy doesn't support it -- gmpy uses binary
throughout.  If you need huge-precision binary floats,
unbounded-precision rational numbers, very fast operations such as
factorials and binomial coefficients on unbounded-precision integers,
then obviously gmpy, since Decimal doesn't support any of these --
Decimal does its job, which is decimal arithmetic, period.

I cannot imagine offhand any task for which I would be in doubt between
using Decimal and using gmpy -- sure, they both deal with numbers, but
there's basically no overlap between their functionality.


Alex



More information about the Python-list mailing list