Tim Peters wrote:
<snip>

> The GNU GMP library (for which Python bindings are available) also
> supports "big floats", but their power operation is also restricted to
> integer powers and/or exact roots.  This can be painful even to try;
> e.g.,
> 
>    >>> from gmpy import mpf
>    >>> mpf("1e10000") ** mpf("3.01")
> 
> consumed well over a minute of CPU time (on a 3.4 GHz box) before dying
> with
> 
>    ValueError: mpq.pow fractional exponent, inexact-root
> 
<snip>

The clnum module handles this calculation very quickly:

>>> from clnum import mpf
>>> mpf("1e10000") ** mpf("3.01")
mpf('9.9999999999999999999999932861e30099',26)
>>> x=_
>>> x ** (1/mpf("3.01"))
mpf('9.9999999999999999999999953924e9999',26)

See http://calcrpnpy.sourceforge.net/clnumManual.html
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to