Precision
Usage
• Precision[x] 给出数x的精度数位的数目。
Notes
• 如果x是一个数,对出现在x中的所有数字Precision[x]给出Precision的最小值。 • 当使用到如同整数的精确数时,Precision给出Infinity。 • 对机器精度数,Precision给出$MachinePrecision。 • 参见 Mathematica 全书 : 节 3.1.4.
Further Examples
Here is an approximate real number.
In[1]:=
|
This gives the total number of digits entered to specify the real number.
In[2]:=
|
Out[2]=
|
This evaluates using numbers with 30 digits of precision.
In[3]:=
|
Out[3]=
|
The result has 30 digits of precision.
In[4]:=
|
Out[4]=
|
Mathematica treats 3.0 as a machine-precision number.
In[5]:=
|
Out[5]=
|
In[6]:=
|
Out[6]=
|
Giving anything less than $MachinePrecision digits yields a machine-precision number.
In[7]:=
|
Out[7]=
|
This evaluates using 30-digit precision numbers.
In[8]:=
|
Out[8]=
|
In this case, the result has a precision of exactly 30 digits.
In[9]:=
|
Out[9]=
|
If you give input only to a few digits of precision, Mathematica cannot give you high-precision output.
In[10]:=
|
Out[10]=
|
If you want Mathematica to assume that 0.142 is exact, then you have to show this explicitly.
In[11]:=
|
Out[11]=
|
|