0
$\begingroup$
a = N[Pi, {20, 19}];
Precision[a] (*19.497149872694134`*)
Accuracy[a](*19.`*)

Accuracy[a]*Log2[10] (*63.116633802859894`*)

My question

The Precision[a] value is a non-integer, which I don't know what it means. And the Accuracy[a]*Log2[10] isn't an integer either. How in the essence the Precision and Accuracy value is measured if not in the number of bit?


What I already know:

The number precision recision is measured in number of bit rather than number of decimals which I deduce by Official Doc about Number Precision:

Note that to achieve full consistency in the treatment of numbers, precision and accuracy often have values that do not correspond to integer numbers of digits.

Therefore the following code runs like :

$MachinePrecision 
(*15.954589770191003`*)
$MachinePrecision == 53/Log2[10] 
(*True*)

Updated 2020-05-11 00:38:50

In an arbitrary-precision number x with precision p, the definition of p is: $p=-\log _{10}\left(\frac{\text{dx}}{x}\right)$, in which dx is the amount of uncertainty. We are using x to approximate an unknown real number y lying in the open interval (x-dx x+dx).

For example:


Clear["*"]
prec = 300;
x = N[Pi, prec];
xAsPreciseValue = 
 SetPrecision[x, 
  prec + 1];(*Here has to be prec+1,to avoid the roundoff made by \
SetPrecision*)
dx = xAsPreciseValue*10^-prec;
N[-Log[10, dx/xAsPreciseValue]](*output 990 as expected*)
Block[
 {Internal`$EqualTolerance = 0},
 TrueQ[
  xAsPreciseValue - dx < Pi < xAsPreciseValue + dx
  ]

 ](*output  all True as expected*)

About the necessity of Internal`$EqualTolerance = 0 in the inequality, refer to this answer

$\endgroup$
9
  • 1
    $\begingroup$ It's explained pretty clear in the documentation for those function, isn't it? (E.g., "With absolute uncertainty dx, Precision[x] is -Log[10,dx/x].") $\endgroup$
    – Michael E2
    May 9, 2020 at 23:20
  • $\begingroup$ @MichaelE2 Oh please give me a link, I cannot find anything even with your keyword:"With absolute uncertainty " $\endgroup$
    – Murphy Ng
    May 9, 2020 at 23:59
  • 2
    $\begingroup$ Maybe this will help: mathematica.stackexchange.com/a/156390/4999. Related: mathematica.stackexchange.com/a/124830/4999 -- HTH! :) $\endgroup$
    – Michael E2
    May 10, 2020 at 0:35
  • 1
    $\begingroup$ Try Block[{Internal`$EqualTolerance = 0}, xAsPreciseValue - dx < Pi < xAsPreciseValue + dx ] (ref. mathematica.stackexchange.com/a/86819/4999) $\endgroup$
    – Michael E2
    May 10, 2020 at 17:45
  • 2
    $\begingroup$ I'm sorry I don't have time to write a complete response to your question. As you have noticed, the numeric environments in Mathematica are complicated. There is one exact one and two approximate ones, machine precision and arbitrary-precision (and arguably another when you set $MinPrecision and $MaxPrecision). Further, in the approximate ones, comparisons <. ==, etc. are made "with tolerance," which can cause further confusion. E.g., the transitive properties of <, == do not always hold. The answer to your question would be long and repeat much of what has already been written. $\endgroup$
    – Michael E2
    May 11, 2020 at 1:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.