This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / Numerical Computation / Numerical Precision  /

  • SetPrecision[ expr , n ] yields a version of expr in which all numbers have been set to have a precision of n digits.
  • 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 zero.
  • SetPrecision returns an arbitrary-precision number, even if the precision requested is less than $MachinePrecision.
  • When expr contains machine-precision numbers, SetPrecision[ expr , n ] 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.
  • SetPrecision[ expr , n ] does not modify expr itself.
  • See the Mathematica book: Section 3.1.5.
  • See also: N, Precision, Chop, SetAccuracy, $MinPrecision, $NumberMarks.

    Further Examples

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



    You can increase the precision to 40 digits.



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