RE: How to display the desired numerical precision?
- To: mathgroup at smc.vnet.net
- Subject: [mg25246] RE: [mg25215] How to display the desired numerical precision?
- From: "David Park" <djmp at earthlink.net>
- Date: Sun, 17 Sep 2000 04:47:24 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Christopher, WRI has changed the behavior of N over versions. It never was meant for formatting numbers. It's basic purpose is to convert exact numbers to approximate numbers. If the precision specified is less than or equal to machine precision it uses machine precision. If it is greater, it uses extended precision approximate numbers. Use NumberForm to control the display of your numbers. The display of machine precision numbers can be set with the Option Inspector. FormattingOptions/ExpressionFormatting/DisplayOptions/PrintPrecision. Another option is to use SetPrecision which allows precisions of less than machine precision also. See Sections 3.1.4 to 3.1.6 in the Mathematica Book. But what you probably really want is NumberForm. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ > -----Original Message----- > From: Christopher R. Carlen [mailto:crcarle at sandia.gov] To: mathgroup at smc.vnet.net > Hi: > > In Mathematica 3, I could input > > N[ Pi, 12 ] > > and see 12 digits of result. However in Mathematica 4 I see 6 > digits, no matter > what I put in for the number of digits, unless >16. In other words, > > N[ Pi, 17 ] > > shows 17 digits. > > It seems that for less than or equal to machine precision, the result > gets displayed using the setting of Formatting Options|Expression > Formatting|Display OPtions|Print Precision. > > But for numbers greater than the maching precision, the result displays > according the precision specified to the N function. > > Can someone tell me how to get the following behavior from Mathematica 4: > > If I don't specify anything about precision, show 6 digits. > > Else if I specify any number of digits to N from 1 to n, then display > n digits. > > Thanks for input. > -- > _______________________ > Christopher R. Carlen > Sr. Laser/Optical Tech. > Sandia National Labs > >