SetAccuracy
✖
SetAccuracy
yields a version of expr in which all numbers have been set to have accuracy a.
Details

- When SetAccuracy is used to increase the accuracy 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.
- SetAccuracy returns an arbitrary‐precision number even if the number of significant digits obtained will be less than $MachinePrecision.
- When expr contains machine‐precision numbers, SetAccuracy[expr,a] can give results that differ from one computer system to another.
- SetAccuracy 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 accuracy 25 on any computer system.
- SetAccuracy[expr,a] does not modify expr itself.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Set the accuracy of all numbers in an expression to 20:

https://wolfram.com/xid/0enwibmvm-igltr4

Convert from a machine number to an arbitrary-precision number with accuracy 32:

https://wolfram.com/xid/0enwibmvm-fxpsa6


https://wolfram.com/xid/0enwibmvm-geborj

Scope (5)Survey of the scope of standard use cases
Set the accuracy of a complex number:

https://wolfram.com/xid/0enwibmvm-kiqka

Convert approximate numbers to exact rational numbers:

https://wolfram.com/xid/0enwibmvm-cua60p

The result has trailing zeros once any hidden digits are exposed:

https://wolfram.com/xid/0enwibmvm-vzjus

SetAccuracy does not affect exact powers:

https://wolfram.com/xid/0enwibmvm-cgmhdi


https://wolfram.com/xid/0enwibmvm-dnui4j

This allows you to, for example, change the accuracy of polynomial coefficients:

https://wolfram.com/xid/0enwibmvm-dnzlyq

https://wolfram.com/xid/0enwibmvm-bmjnp


https://wolfram.com/xid/0enwibmvm-qn4emm

Special rules may apply to data objects:

https://wolfram.com/xid/0enwibmvm-dzy2xd

For an InterpolatingFunction object, SetAccuracy changes the appropriate data only:

https://wolfram.com/xid/0enwibmvm-czn2jw


https://wolfram.com/xid/0enwibmvm-g7kuk2

It works as an approximate function, but with arithmetic appropriate for the modified data:

https://wolfram.com/xid/0enwibmvm-b58wqk

Applications (1)Sample problems that can be solved with this function
Find the roundoff error in evaluating an expression with machine numbers:

https://wolfram.com/xid/0enwibmvm-c56v6m


https://wolfram.com/xid/0enwibmvm-8rl9e


https://wolfram.com/xid/0enwibmvm-bn5rtu


https://wolfram.com/xid/0enwibmvm-comktm

This dominates the approximation error since the increment is so small:

https://wolfram.com/xid/0enwibmvm-bfvmf8

Properties & Relations (2)Properties of the function, and connections to other functions
SetAccuracy just sets the precision of numbers, while N works adaptively:

https://wolfram.com/xid/0enwibmvm-cxhcqf

Since N works adaptively, the result has the requested accuracy of 20:

https://wolfram.com/xid/0enwibmvm-bst5qf

Use SetAccuracy:

https://wolfram.com/xid/0enwibmvm-buajcq

The accuracy is less than 20 because of the way the exponential function magnifies the result:

https://wolfram.com/xid/0enwibmvm-hubzyl

SetAccuracy effectively evaluates Exp with argument 10 to accuracy 20:

https://wolfram.com/xid/0enwibmvm-bjrxnz

For nonzero numbers , SetAccuracy[x,a] is equivalent to SetPrecision[x,a+e]:

https://wolfram.com/xid/0enwibmvm-rk3de


https://wolfram.com/xid/0enwibmvm-igbinz

e is given by RealExponent:

https://wolfram.com/xid/0enwibmvm-t3vjn

Wolfram Research (1991), SetAccuracy, Wolfram Language function, https://reference.wolfram.com/language/ref/SetAccuracy.html.
Text
Wolfram Research (1991), SetAccuracy, Wolfram Language function, https://reference.wolfram.com/language/ref/SetAccuracy.html.
Wolfram Research (1991), SetAccuracy, Wolfram Language function, https://reference.wolfram.com/language/ref/SetAccuracy.html.
CMS
Wolfram Language. 1991. "SetAccuracy." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SetAccuracy.html.
Wolfram Language. 1991. "SetAccuracy." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SetAccuracy.html.
APA
Wolfram Language. (1991). SetAccuracy. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SetAccuracy.html
Wolfram Language. (1991). SetAccuracy. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SetAccuracy.html
BibTeX
@misc{reference.wolfram_2025_setaccuracy, author="Wolfram Research", title="{SetAccuracy}", year="1991", howpublished="\url{https://reference.wolfram.com/language/ref/SetAccuracy.html}", note=[Accessed: 29-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_setaccuracy, organization={Wolfram Research}, title={SetAccuracy}, year={1991}, url={https://reference.wolfram.com/language/ref/SetAccuracy.html}, note=[Accessed: 29-March-2025
]}