Re: approximation
- To: mathgroup at smc.vnet.net
- Subject: [mg79443] Re: approximation
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 27 Jul 2007 05:43:22 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <f89t1u$9af$1@smc.vnet.net>
giorgioruaro at gmail.com wrote: > hello. My question is very very easy. > I have got a variabile as "a" and i want to print his approximated > value with n decimal digit. > > a=1.56068376362920545943; > Print["The value is : ", 1.6]; > or > Print["The value is : ", 1.56]; > > Is there anyone who can help me ? > thanks > Giorgio Hi Giorgio, You could use *NumberForm* to control the display of your variable. See http://reference.wolfram.com/mathematica/ref/NumberForm.html?q=numberform For instance, a = 1.56068376362920545943`20.193314912271752; Print["The value is : ", NumberForm[a, {2, 1}]]; Print["The value is : ", NumberForm[a, {3, 2}]]; The value is : 1.6 The value is : 1.56 Regards, Jean-Marc