math module for Decimals
dickinsm at gmail.com
Tue Jan 6 20:29:55 CET 2009
On Jan 6, 3:23 pm, Fredrik Johansson <fredrik.johans... at gmail.com>
> FYI, mpmath (http://code.google.com/p/mpmath/) implements arbitrary-
> precision standard transcendental functions in pure Python. It is much
> faster than decimal, dmath, decimalfuncs and AJDecimalMathAdditions,
> and handles huge arguments just fine.
Yes, I think mpmath was mentioned already somewhere above;
it sounds like a perfect tool for the OP's requirements.
Note that it's still subject to the same limitations as anything
else for trig_function(really huge argument), of course:
>>> import mpmath
[... still waiting for a result 30 minutes later ...]
(not a criticism of mpmath: just a demonstration that this
really is pretty much unavoidable).
Out of curiosity, what sort of guarantees does mpmath give on
error bounds? It looks like it aims for 'almost correctly
rounded'; i.e., error < 0.500...001 ulps.
Here's one place in mpmath where it looks as though more
internal precision is needed (with default settings: 53-bit
>>> mpmath.log(mpmath.mpc(0.6, 0.8))
Shouldn't the real part here be something like:
instead of 0.0?
More information about the Python-list