0
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

Murphy Ng
  • 177
  • 7
  • 1
    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].") – Michael E2 May 09 '20 at 23:20
  • @MichaelE2 Oh please give me a link, I cannot find anything even with your keyword:"With absolute uncertainty " – Murphy Ng May 09 '20 at 23:59
  • @MichaelE2 Found it using your keyword "With absolute uncertainty" in Google. But I still don't know what does it mean by dx. Really appreciate if you could elaborate on it" – Murphy Ng May 10 '20 at 00:06
  • 2
    Maybe this will help: https://mathematica.stackexchange.com/a/156390/4999. Related: https://mathematica.stackexchange.com/a/124830/4999 -- HTH! :) – Michael E2 May 10 '20 at 00:35
  • @MichaelE2 Everything is here, it's just damn hard to filter it out… – Murphy Ng May 10 '20 at 02:22
  • @MichaelE2 I spent the whole day reading through many of your answers on numeric precision. It's really profound and rigorous. However I still have many questions. Please see my edited question above. – Murphy Ng May 10 '20 at 16:47
  • 1
    Try Block[{Internal`$EqualTolerance = 0}, xAsPreciseValue - dx < Pi < xAsPreciseValue + dx ] (ref. https://mathematica.stackexchange.com/a/86819/4999) – Michael E2 May 10 '20 at 17:45
  • 2
    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. – Michael E2 May 11 '20 at 01:38
  • @MichaelE2 Internal`$EqualTolerance = 0 worked, I'm searching things about EqualTolerance, thanks a lot! – Murphy Ng May 11 '20 at 01:47

0 Answers0