mpmath puzzle

Mark Dickinson dickinsm at gmail.com
Wed Nov 14 17:13:00 EST 2007


On Nov 14, 2:45 pm, "Fredrik Johansson" <fredrik.johans... at gmail.com>
wrote:

> Unlike mpmath, the decimal module doesn't support non-integer powers
> (except for square roots), and nor does gmpy (though you can do them
> indirectly as mensanator showed earlier in the thread). And numpy /
> scipy don't support arbitrary-precision floats.

But in Python 2.6 (and in the current trunk), it will:

Python 2.6a0 (trunk:58930, Nov 10 2007, 20:54:42)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import Decimal, getcontext
>>> getcontext().prec = 32
>>> 1234**Decimal("10.9")
Decimal("4.9583278648155041477415234438717E+33")
>>>

Mark




More information about the Python-list mailing list