SetAccuracy
Usage
• SetAccuracy[expr, n] 把expr中所有数设置为具有n个数位的准确度并返回expr.
Notes
• 当使用SetAccuracy来提高一个数的准确度时,该数将被用0填充.0采用的基底为2.在基底为10时,附加数位通常不是0. • 即便所得到的重要数位的数比$MachinePrecision小,SetAccuracy仍返回一个任意精度的数. • 当 expr 包含机器精度的数时, 在不同计算机系统上SetAccuracy[expr, n]能给出不同的结果. • SetAccuracy首先打开一个数的内部二进制表示中所有隐藏的特殊数位,且只有用完这些之后才添加尾数0. • 在任何计算机系统上0.004``25生成一个所有末尾数字为0,准确度为25的数. • SetAccuracy[expr, n] 不修改 expr 本身.
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]=
|
|