Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'Number of decimals' topicStudent Support Forum > General > Archives > "Number of decimals"

Next Comment >Help | Reply To Topic
Author Comment/Response
04/24/03 10:27am

In version 2.2 the expression x=N[Sqrt[2],2] printed in the monitor as 1,41 but the x value was still x==Sqrt[2]. In version 4.X the same expression provides 1.41421. The command
NumberForm[N[Sqrt[2]],2] prints as the old N[] did, but the result has a Head "NumberForm". It is possible to transform it into the number 1.41 using
x= ToExpression[ToString[NumberForm[N[Sqrt[2]],2]] ]
], but this is rather uncomfortable and the x value is now x==1.41 not Sqrt[2]. It is still possible to print Sqrt[2] with more than 16 decimals using the N[] command but this seems to become useless for small number of decimals.
From the help window I thinck that minimal number of decimals is controlled by $MinPrecision but this is set to 0 by default.
Is there any way to control the printed number of decimals preserving the internal value of a number?
Thanks a lot,

URL: ,

Subject (listing for 'Number of decimals')
Author Date Posted
Number of decimals Page 04/24/03 10:27am
Re: Number of decimals Henry Lamb 04/26/03 9:14pm
Next Comment >Help | Reply To Topic