Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Precision & Accuracy Control >

SetPrecision

SetPrecision[expr, p]
yields a version of expr in which all numbers have been set to have precision p.
  • When SetPrecision is used to increase the precision 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 zeros.
  • If expr contains machine-precision numbers, SetPrecision[expr, p] can give results which differ from one computer system to another.
  • SetPrecision 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 precision 25 on any computer system.
Convert all numbers in an expression to 20-digit precision:
In[1]:=
Click for copyable input
Out[1]=
 
Convert all numbers to machine precision:
In[1]:=
Click for copyable input
Out[1]=
 
Convert from a machine-number to an arbitrary-precision number:
In[1]:=
Click for copyable input
Out[1]=
New in 2 | Last modified in 5
© 2013 Wolfram Research, Inc. Japanese
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team