On Jan 6, 3:23 pm, Fredrik Johansson <fredrik.johans...@gmail.com>
wrote:
> 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
>>> mpmath.cos(mpmath.mpf('1e999999999'))
[... 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
precision, etc.)

>>> mpmath.log(mpmath.mpc(0.6, 0.8))
mpc(real='0.0', imag='0.9272952180016123')

Shouldn't the real part here be something like:

2.2204460492503132e-17

instead of 0.0?

Mark
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to