Precision
Usage
Notes
Further Examples
Here is an approximate real number.
In[1]:=
|
This gives the precision of the real number.
In[2]:=
|
Out[2]=
|
This evaluates attempting to get a result with precision .
In[3]:=
|
Out[3]=
|
The result has precision .
In[4]:=
|
Out[4]=
|
Mathematica treats as a machine-precision number.
In[5]:=
|
Out[5]=
|
This evaluates using machine-precision numbers.
In[6]:=
|
Out[6]=
|
This evaluates using 30-digit precision numbers.
In[7]:=
|
Out[7]=
|
In this case, the result has a precision slightly less than .
In[8]:=
|
Out[8]=
|
This evaluates trying to get a result with precision .
In[9]:=
|
Out[9]=
|
Now the result has precision 30.
In[10]:=
|
Out[10]=
|
If you give input as a machine number, N cannot give you high-precision output.
In[11]:=
|
Out[11]=
|
SetPrecision can be used to convert machine numbers to high-precision.
In[12]:=
|
Out[12]=
|
If you want an exact representation of , then you have to convert it explicitly.
In[13]:=
|
Out[13]=
|
In[14]:=
|
|