Re: N[ ] function problem
- To: mathgroup at smc.vnet.net
- Subject: [mg41615] Re: [mg41607] N[ ] function problem
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Thu, 29 May 2003 08:13:40 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Actually it all works "as advertised", just you have to read the small print ;-) Although In[1]:= N[Pi,12] Out[1]= 3.14159 It in fact is a floating point number with "formal" precision: In[2]:= Precision[%] Out[2]= 16 Note, 16, not 12 and not 6. However, to see more digits you have to use NumberForm: In[3]:= NumberForm[N[Pi,12],12] Out[3]//NumberForm= 3.14159265359 If you really want a number with 12 digits of precision (with all that implies) you have ot use SetPrecision: In[4]:= SetPrecision[Pi,12] Out[4]= 3.14159265359 No need for NumberForm this time. In[5]:= Precision[%] Out[5]= 12 By the way, this behaviour was actually one of the changes that were made in transition form v. 3 to 4. Presumably it was meant to help distinguish floating point numbers from low precision "extended precision" numbers. As it seems to be confusing to many people it may well be changed again. Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/ On Wednesday, May 28, 2003, at 05:57 pm, Warren Wolfe wrote: > I have found that the N[expr, n] function always returns 6 digits for > n < > 17. Above 17 it works as advertised. I am using version 4.2 on a > Windows 98 > machine. I did not have this problem with version 3.0 on this machine. > Can > anyone give me a clue what's happening? > > Warren Wolfe > > >