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
dx. Really appreciate if you could elaborate on it" – Murphy Ng May 10 '20 at 00:06Block[{Internal`$EqualTolerance = 0}, xAsPreciseValue - dx < Pi < xAsPreciseValue + dx ](ref. https://mathematica.stackexchange.com/a/86819/4999) – Michael E2 May 10 '20 at 17:45$MinPrecisionand$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:38Internal`$EqualTolerance = 0worked, I'm searching things aboutEqualTolerance, thanks a lot! – Murphy Ng May 11 '20 at 01:47