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

Dick Moores rdmoores at gmail.com
Mon Jan 15 02:35:31 CST 2007


On 1/15/07, Robert Kern <robert.kern at gmail.com> wrote:
> Dick Moores wrote:
>
> > Well if you mean for me to do:
> > =============================
> > # clnumTest1-b.py
> >
> > import clnum as n
> >
> > n.set_default_precision(50)
> >
> > print n.log(640320**3 + 744)/n.sqrt(163)
> > ==================================
> > That gives me 3.1415926535897932385 .
> >
> > So I STILL don't understand.
>
> It looks like the __str__ representation of clnum numbers (i.e. what you get by
> printing them, or by calling str() on them) is restricted to that many digits
> regardless of what the actual precision of the object is. Look at the example at
> the bottom of clnum's webpage:
>
>   http://calcrpnpy.sourceforge.net/clnum.html
>
> However, looking at the __repr__ representation (i.e. what was printed in the
> Out[18] in the above example, and what can be obtained by calling repr() on the
> object), you can see all of the digits that are available according to the
> precision of the object.

OK! I tried
============================
# clnumTest1-c.py

import clnum as n

n.set_default_precision(50)

print repr(n.log(640320**3 + 744)/n.sqrt(163))
==================================
And got
mpf('3.141592653589793238462643383279726619347549880883522422293',55)

Great! Thanks to you all!

BTW what's the 55 at the end? There are 58 digits including the initial 3.

> > Also, what are those In [16]: things all you people use? Is that line
> > 16? If so, line 16 of what?
>
> It's just the IPython input prompt, like the >>> of the regular interpreter.

Oh.

Dick


More information about the SciPy-user mailing list