high precision mathematics

Paul Rubin phr-n2002a at nightsong.com
Sat Feb 16 23:57:17 EST 2002

"I.J." <shiver at yubc.net> writes:
> Is there a module for python that grants ussage of decimal numbers with more
> than 14 decimal places, including all scientific functions to do with those
> numbers?

Gmpy (http://gmpy.sourceforge.net) does arbitrary precision floating
point math.  It doesn't include any scientific functions beyond
arithmetic and square root though.  You might be able to adapt the
"bc -l" library to compute scientific functions with gmpy.

Note that normal 64-bit IEEE doubles give you 53 mantissa bits or
16-17 decimal digits.  You might be able to recompile Python to use
long doubles (80 bits on x86 computers) which will give you about 20
decimal digits.  I don't know if that's enough for your application.

More information about the Python-list mailing list