Re: How to printout more digits?

*To*: mathgroup at smc.vnet.net*Subject*: [mg46157] Re: How to printout more digits?*From*: phbrf at t-online.de (Peter Breitfeld)*Date*: Mon, 9 Feb 2004 05:54:05 -0500 (EST)*References*: <c04f0p$ggi$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Toshiyuki (Toshi) Meshii <meshii at mech.fukui-u.ac.jp> wrote: > Hello, > > I want to print out (or write to a file) outputs with more than 9 digits. > For example, I know that > > Print[ N[Pi, 9] ] > returns > 3.14159265 > ,which is OK. > > But, > Print[ N[6. * Pi, 9] ] > returns > 18.8496 > which is only 6 digits and not what I expected. > > Does anybody know how to print out outputs with more than 9 digits? > > In addition, I want to write the outputs in a file, such as csv files. > If you know ideas for this, please let me know too. > > -Toshi Since Mathematica 4.0 N[number,precision] always returns only 6 Digits for machine Precision numbers, and as you can see Precision[6.*Pi] gives $MachinePrecision. To get all the wanted nine digits you can do one of the following: N[6.0`9*Pi] --> 18.8495559 Precision[%] --> 9 or you use NumberForm: NumberForm[6.*Pi, 9] giving 18.8495559 too, but Precision[%] --> $MachinePrecision NumberForm only changes the display of the number not its Precision. The Precision of Pi and other values like Sqrt[2] is Infinity, so N[Pi, digits] always will show the wanted number of digits and associate the right precision to the result: Precision[N[Pi,9]] --> 9. -- Gruß Peter -- ==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-== Peter Breitfeld, Bad Saulgau, Germany -- <http://www.pBreitfeld.de>