working with VERY large 'float' and 'complex' types
Fernando Perez
fperez.net at gmail.com
Wed Sep 14 15:44:17 EDT 2005
Todd Steury wrote:
> 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).
Python floats are C doubles underneath, so you're stuck. You need extended
numeric types. Decimal is slow as molasses, and was not designed for
mathematical work (rather for finance-type fixed-point work). Use this
instead:
http://calcrpnpy.sourceforge.net/clnumManual.html
Cheers,
f
More information about the Python-list
mailing list