Decimal and Exponentiation

Raymond L. Buvel levub137 at wi.rr.com
Sat May 20 12:57:25 CEST 2006


elventear wrote:
> Hi,
> 
> I am the in the need to do some numerical calculations that involve
> real numbers that are larger than what the native float can handle.
> 
> I've tried to use Decimal, but I've found one main obstacle that I
> don't know how to sort. I need to do exponentiation with real
> exponents, but it seems that Decimal does not support non integer
> exponents.
> 
> I would appreciate if anyone could recommend a solution for this
> problem.
> 
> Thank you.
> 
The clnum module has arbitrary precision floating point and complex
numbers with all of the standard math functions.  For example, the cube
root of 2 can be computed to 40 decimal places with the following.

>>> from clnum import mpf,mpq
>>> mpf(2,40)**mpq(1,3)
mpf('1.259921049894873164767210607278228350570251464701',46)

For more information see

http://calcrpnpy.sourceforge.net/clnumManual.html




More information about the Python-list mailing list