Mathematica 9 is now available

SetPrecision

Usage

SetPrecision[expr, n]expr中所有数设置为具有n个数位的精确度并返回expr.


Notes

• 当使用SetPrecision来提高一个数的精确度时,该数将被用0填充.0采用的基底为2.在基底为10时,附加数位通常不是0.
• 即便要求的精度比$MachinePrecision小,SetPrecision仍返回一个任意精度的数.
• 当 expr 包含机器精度的数时, 在不同计算机系统上SetPrecision[expr, n]能给出不同的结果.
SetPrecision首先打开一个数的内部二进制表示中所有隐藏的特殊数位,且只有用完这些之后才添加尾数0.
• 在任何计算机系统上0.004`25生成一个所有末尾数字为0,精确度为25的数.
SetPrecision[expr, n] 不修改 expr 自身.
• 参见Mathematica 全书: 3.1.5节.
Further Examples

Here is a machine-precision real number approximation of 1/3.

In[1]:=  

Out[1]=

You can increase the precision to 40 digits.

In[2]:=  

Out[2]=

The additional digits are 0 in base 2, not in base 10. (Mathematica uses base 2 internally to represent numbers.)

In[3]:=  

Out[3]//BaseForm=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.