15

Is there a rationale why SetPrecision works on integers except for 0?

SetPrecision[1,5]

1.0000

SetPrecision[0,5]

0

alancalvitti
  • 15,143
  • 3
  • 27
  • 92

2 Answers2

20

If you have a value $x$ with an absolute uncertainty $dx$ the precision of $x$ is by definition:

$$\text{Precision}(x) = - \log_{10}(dx/x)$$

That is why for $x=0$ the precision is always infinity. You cannot change this by changing $dx$.

If you want to assign an absolute uncertainty to zero, you can set accuracy, which is defined as

$$\text{Accuracy}(x) =- \log_{10}(dx)$$

This can be done using SetAccuracy command:

SetAccuracy[0, 5]

0.*10^-5

Ray Shadow
  • 7,816
  • 1
  • 16
  • 44
11

From SetPrecision:

Mathematica graphics

See also Precision and Accuracy.

Michael E2
  • 235,386
  • 17
  • 334
  • 747