Re: Rounding Errors and Irregulars?
- To: mathgroup at smc.vnet.net
- Subject: [mg42046] Re: [mg42015] Rounding Errors and Irregulars?
- From: David Withoff <withoff at wolfram.com>
- Date: Tue, 17 Jun 2003 05:43:33 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
> Hi > > Is there a way to tell Mathematica not to *round* ? > > Example: > In[x]:= SetPrecision[Pi, 10] > > Out[x]:= 3.14159265{4} > > The {4} is rounded, non-rounded should say {3}. > > Thanks, > Jason SetPrecision[Pi, 10] returns a number with a nominal value of 3.141592653589793238458599 and a relative uncertainty of 10^-10: In[]:= InputForm[SetPrecision[Pi, 10]] Out[]//InputForm= 3.141592653589793238458599`10 so SetPrecision did not do any rounding. Your example suggests that perhaps what you want is different rounding (rounding down) rather than no rounding. When the number is displayed Mathematica will round it to the nearest 10-digit decimal. You can use In[]:= SetPrecision[Floor[Pi 10^9]/10^9,10] Out[]= 3.141592653 to get a number that is rounded down to the next smaller 10-digit decimal.