0
$\begingroup$

We know that

 N[3/7,100] 

will keep 100 digits after decimal point.

But

N[3.1/7,100]

will Keep only machine precision fewer than 100.

So, if I need 100 dicimal digits, I should convert N[3.1/7,100] to N[31/70,100]. However, in some long codes, to keep 100 decimal digits, it is not relistic to check every N[] whether it contains decimal point.

Is there any way to keep 100 decimal digits no matter of 3.1 or 31?

$\endgroup$
12
  • $\begingroup$ How about N[Rationalize[3.1/7, 0], 100]? $\endgroup$
    – user64494
    Feb 11, 2022 at 10:52
  • $\begingroup$ @user64494 Change every N[] in the note? It is large work. $\endgroup$
    – Y. zeng
    Feb 11, 2022 at 10:55
  • $\begingroup$ @Nasser How to determine the length after decimal point? SetAccuracy can't. $\endgroup$
    – Y. zeng
    Feb 11, 2022 at 10:59
  • 2
    $\begingroup$ You are confusing Accuracy and Precision. N[..,n] gives Precision of n, not Accuracy of n $\endgroup$ Feb 11, 2022 at 11:26
  • 1
    $\begingroup$ How about '3.1`100/7` $\endgroup$
    – murray
    Feb 11, 2022 at 16:38

0

Your Answer

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