[SciPy-dev] Exact calculation

Pearu Peterson pearu at cens.ioc.ee
Fri Nov 1 09:25:51 CST 2002

On 31 Oct 2002, Travis Oliphant wrote:

> What is the feeling of this group about adding some kind of 
> exact real number calculation module to scipy.

I am positive about it, really.

> I know there is a wrapping of the gnu multiprecision library that is
> GPL.
> But, there is an excellent self-contained module called real.py that is
> completely free (no expressed copyright) By Jurjen N.E. Bos
> (jurjen at q2c.nl).

real.py looks very nice (shows errors, has various elementary
functions, has docs but no unittests:( etc.) but it is dead slow compared
to GMPY. I would hope that in scipy we could have more efficient and
longer lasting tools for exact calculation than real.py.

For example,

peterson at utmws130:~/tmp > python bench_exact.py 
real.py:101: DeprecationWarning: the regex module is deprecated; please
use the re module
  import math, regex, marshal, string, sys

gmpy float multiplication took 3600.00 secs
real float multiplication took 107000.00 secs


# file bench_real.py
from scipy_test.testing import jiffies
import gmpy
import real


a1 = 1/gmpy.mpf('3')
a2 = 1/real.r(3)

i = n
while i:
    i -= 1
print 'gmpy float multiplication took %.2f secs' % (100*(et-st))

i = n
while i:
    i -= 1
print 'real float multiplication took %.2f secs' % (100*(et-st))

# eof

More information about the Scipy-dev mailing list