working with VERY large 'float' and 'complex' types

Todd Steury sciurus1 at iwon.com
Wed Sep 14 13:38:09 EDT 2005


Greetings Python'ers:

I'm just an amature who occasionally uses Python for complex mathematical 
models. The current model I'm working with occasionally generates really 
large numbers that are either "float" or "complex" types. These numbers are 
so large that I either get an overflow error, or some funky code like #INF 
or 1.#INDj. However I really need these numbers to be calculated (although 
precision isn't key). Is there a way to get python to increase the size 
limit of float and complex numbers? I should mention that I'm using a lot of 
pre-made modules and functions like math.exp() and scipy.special.erf() that 
don't seem to be able to use available types like "Decimal" or "FixedPoint" 
(especially since these don't seem to handle complex numbers).

Since I learn best by example, how could one solve the following problem:

from math import exp
>>>x=1000.
>>>z=exp(x)

so that z returns an actual value

Thanks in advance for any advice!

Todd 





More information about the Python-list mailing list