high precision mathematics

Alex Martelli aleax at aleax.it
Sun Feb 17 12:34:49 EST 2002


Paul Rubin wrote:

> "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.

I suspect it might be easier to adapt/wrap MPFR, see
http://www.loria.fr/projets/mpfr/ , exploiting the C-API that
gmpy exposes and the fact that MPFR is meant to work with GMP
(which gmpy wraps).  I'll have to get back to gmpy and polish
it up a bit one of these days (even though I'm currently doing
no multiprecision computations -- which is my excuse for having
let gmpy collect some dust lately...) and I may then check
back into MPFR and how hard it would be to wrap.

MPFR only supplies log, exp, sin and cos (but, to whatever
degree of precision is required).  So, it may not meet the
requirement for "all" scientific functions.


Alex




More information about the Python-list mailing list