(While there are similarities with my question here, this question deals with what Mathematica refers to as 'arbitrary precision numbers' and the former question deals with machine-precision numbers. Regardless, the behavior I'm trying to understand here is different than what I am trying to understand in the former question.)
Executing DecimalForm[N[\[Pi] - 80143857/25510582, 5]] in Mathematica 11.3 gives me the following result: 0.00000000000000057909.
Executing Precision on that result yields 5.. This makes sense because I asked for a precision of 5 as an argument to N. Executing Accuracy on the result yields 20.373. This makes sense because the number of digits to the right of the decimal is 20.
Wolfram tells us that Precision is the "total number of digits of precision" and that Accuracy is the "number of significant digits to the right of the decimal."
The understanding I've always had of significant figures/digits comports more-or-less with what is stated here: "any of the digits of a number beginning with the digit farthest to the left that is not zero and ending with the last digit farthest to the right that is either not zero or that is a zero but is considered to be exact."
If the value 0.00000000000000057909 is known to be exact (perhaps with an uncertainty around the last digit), I would simply state that it has 20 significant digits. Saying that it has a 'precision' of 5 seems strange.
If I now change the starting calculation to DecimalForm[N[\[Pi] - 80143857/25510582 + 1, 5]] we fall off of a cliff it seems, as I now get an answer of 1.0000 and Precision and Accuracy now yield, respectively, 5. and 5..
What happened to all of my accuracy digits?
If I execute FullForm on the new value, it yields 1.0000000000000005791`5. which shows that the information is the same up to the 18th digit. It makes sense to me that having added an integer component to the original would have reduced the number of known significant digits by ~1 digit or so, and it seems reasonable to look at the result as having 19 significant digits due to uncertainties around the final digit of the original 0.00000000000000057909.
Hence, can I know how many significant digits are in a result?
(FWIW, I tried to create a function that would handle the various types of results one gets from RealDigits, but was not successful.)
Thanks.
Per @MichaelE2's comment, I have added the following which is too long for a comment: The following confirms that each value has infinite precision and accuracy, not just 1:
Precision[\[Pi]] Accuracy[\[Pi]] Precision[80143857/25510582] Accuracy[80143857/25510582] Precision[1] Accuracy[1] When I add two of the infinite precision and accuracy values together like so:
Precision[N[\[Pi] - 80143857/25510582, 5]] Accuracy[N[\[Pi] - 80143857/25510582, 5]] The result shows 5 and 20.2373.
When I add three of the infinite precision and accuracy values together
Precision[N[\[Pi] - 80143857/25510582 + 1, 5]] Accuracy[N[\[Pi] - 80143857/25510582 + 1, 5]] the result shows 5 and 5.
If I do as @MichaelE2 suggested:
Precision[1 + N[\[Pi] - 80143857/25510582, 5]] Accuracy[1 + N[\[Pi] - 80143857/25510582, 5]] I get 20.2373 and 20.2373, but I don't see how that sheds light on my original question, as the original question is dealing with two and three exact values respectively that only differ by a magnitude of 1, yet have wildly different accuracy values.
Precision[]is correct both times, for the same reason. Twice you asked for 5 correct digits, and you got five both times. I think what you don't understand completely is how precision and accuracy work in arbitrary-precision arithmetic, how arbitrary-precision numbers are represented, and exactly howN[]works. Have you tried adding1to your first result, like this?:Precision[1 + N[\[Pi] - 80143857/25510582, 5]]. Note that the1is now outside theN[..], and that is, ahem, significant. It is also significant that1has infinite precision. $\endgroup$Accuracy[], which is given in Numbers to which you were referred by Bob Hanlon in your related Q&A. It's probably in the function's doc page, too. $\endgroup$