On Mon, Jul 10, 2006 at 08:46:33AM -0500, Robert Kern wrote: > Tim Hochberg wrote: > > Nils Wagner wrote: > >> Hi all, > >> > >> how can I increase the number of digits in the output of str(.) ? > >> > > You can't as far as I know. For floats, you can use "%.nf". For example: > > > > "%.13f" % 493.4802200544680 > > The problem is is that he doesn't have a float. He has one of our > float64scalar > objects. The str() of a real Python float will give as many digits as are > necessary to recreate number and no more (or maybe one or two more). A str() > of > a float64scalar will round according to some rule that I haven't figured out, > yet. It doesn't seem to be configurable with numpy.set_printoptions().
This is a different ptoblem from the one exposed by Nils. I mean, tha fact that str() on numpy.float64 objects is somewhat obscure is a problem that should obviously be addressed some day. However, as far as I understand Nils' message, the "%.13f" trick is enough for what he need. But I may be wrong... He just want to "increase the number of digits", not have the "optimal" number of digits (as long as this is meaningfull). But I may have missed something. David -- David Douard LOGILAB, Paris (France) Formations Python, Zope, Plone, Debian : http://www.logilab.fr/formations Développement logiciel sur mesure : http://www.logilab.fr/services Informatique scientifique : http://www.logilab.fr/science
signature.asc
Description: Digital signature
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion