[SciPy-user] Can SciPy compute ln(640320**3 + 744)/163**.5 to 30 places?

Fernando Perez fperez.net at gmail.com
Mon Jan 15 16:32:53 CST 2007


On 1/15/07, Dick Moores <rdm at rcblue.com> wrote:

> Is there a better way to print the result without the leading "mpf('"
> and the trailing "',55)"?

Not that I can see right away.

>
> The only clnum manual I found was
> <http://calcrpnpy.sourceforge.net/clnumManual.html>, which is
> obviously incomplete. How does anyone learn as much about it as you do?

I don't know how good the manual is, I've never had a look at it.

I just use the tab key and the ? operator in ipython.  It's a handy little tool:

http://ipython.scipy.org

For instance:

In [29]: n.*cos*?
n.acos
n.acosh
n.cos
n.cosh

In [30]: n.mpf?
Type:           type
Base Class:     <type 'type'>
Namespace:      Interactive
File:
/home/fperez/tmp/local/lib/python2.4/site-packages/clnum/__init__.py
Docstring:
    mpf(x) -> extended precision floating point number
    mpf(x,prec) -> extended precision floating point number

    Convert a string or number to an extended precision floating point number,
    if possible.  The optional prec is the number of decimal digits.



> And finally (I think), could you show me how to do division and
> multiplication with precision? Say 7596.52/632517 and
> 123.45678987654321 times 298374.287364827364287346?

In [25]: f = n.mpf

In [26]: f('7596.52')/632517
Out[26]: mpf('0.012009985502365944314540162556895703988983695299889172939225',55)

In [27]: f('123.45678987654321')*f('298374.287364827364287346')
Out[27]: mpf('3.683633169976281356247722948026362522066000000000000000001e7',55)



Cheers,

f


More information about the SciPy-user mailing list