a = N[Pi, {20, 19}];
Precision[a] (*19.497149872694134`*)

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 == 53/Log2[10] 

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:

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

 ](*output  all True as expected*)

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

  • 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 '20 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 '20 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 '20 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 '20 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 '20 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.