[SciPy-user] Print number of significant digits ?

Stef Mientki S.Mientki at ru.nl
Fri Jun 15 06:02:15 EDT 2007



Joachim Dahl wrote:
> print "%3.2f" %pi
thanks Joachim,

but I didn't phrase my question accurate enough,
I not only want to print pi, but I want to print anything

e.g. I now get:
  Model 1.0000000149 1.0 [ 1.00000001  1.00000001  3.00000001  
4.00000001  5.00000001]

but I want
  Model 1.00 1.0 [ 1.00  1.00  3.00  4.00  5.00]

and as I use "print" as a quick and dirty intermediate result for 
everything,
I don't want to spell out each format statement.

cheersm
Stef Mientki



>
> On 6/15/07, *Stef Mientki* <S.Mientki at ru.nl <mailto:S.Mientki at ru.nl>> 
> wrote:
>
>     hello,
>
>     is there a simple way (some flag or something like that),
>     in which you can limit the number of significant digits,
>     when using the plain print statement ?
>
>     so that you get an output like this:
>
>     >>> print pi
>     3.14
>
>
>     thanks,
>     Stef Mientki
>
>     Kamer van Koophandel - handelsregister 41055629  / Netherlands
>     Chamber of Commerce - trade register 41055629
>
>
>     _______________________________________________
>     SciPy-user mailing list
>     SciPy-user at scipy.org <mailto:SciPy-user at scipy.org>
>     http://projects.scipy.org/mailman/listinfo/scipy-user
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>   

Kamer van Koophandel - handelsregister 41055629  / Netherlands Chamber of Commerce - trade register 41055629





More information about the SciPy-User mailing list