 |
SetAccuracy
SetAccuracy[
expr
,
n
] yields a version of expr in which all numbers have been set to have an accuracy of n digits.
When SetAccuracy is used to increase the accuracy of a number, the number is padded with zeros. The zeros are taken to be in base 2. In base 10, the additional digits are usually not zero. SetAccuracy returns an arbitrary-precision number even if the number of signficant digits obtained will be less than $MachinePrecision. When expr contains machine-precision numbers, SetAccuracy[
expr
,
n
] can give results which differ from one computer system to another. SetAccuracy will first expose any hidden extra digits in the internal binary representation of a number, and only after these are exhausted add trailing zeros. 0.004``25 generates a number with all trailing digits zero and accuracy 25 on any computer system. SetAccuracy[
expr
,
n
] does not modify expr itself. See the Mathematica book: Section 3.1.5. See also: N, Accuracy, SetPrecision.
Further Examples
When an expression contains machine-precision real numbers, Mathematica tries to do all computations at machine-precision level.
In[1]:= 
Out[1]= 
This causes a loss of accuracy. One of the inputs had an accuracy of 30 digits but the result has an accuracy of only 16 digits.
In[2]:= 
Out[2]= 
In[3]:= 
Out[3]= 
By raising the accuracy of each subexpression, you can increase the accuracy of the overall result.
In[4]:= 
Out[4]= 
In[5]:= 
Out[5]= 
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT. SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION. | | | |
 | |
|