I have a rather silly question, so please excuse me=)

Let's say I have a general Mathematica code, where I numerically evaluate and combine several quantities. I would like to know how to determine the number of the significant digits of my final result. Does it depend on the significant digits of my input numbers, or is it limited by the code itself?

Cheers, ikarus

  • 1
    $\begingroup$ You might want to read about Precision. I believe the number of significant digit is controlled by the environment variable $WorkingPrecision. Maybe some expert will confirm/infirm. But certainly not by the digits of the input numbers. $\endgroup$
    – anderstood
    Sep 20, 2020 at 12:59
  • 1
    $\begingroup$ I do such an estimate here. Look for Block[{f1, f2, x2, y}, {f1, f2, x2, y} = SetPrecision[{1/2, 1/3, 1, Pi - 1*^-8}, 100]; 100 - Precision[int]] and the following code block. The expression int has a Precision of Infinity, and the precision needs to be at least 100. Then the code returns the number of digits of precision lost. You can set the precision of your input numbers (including constant parameters in your code) to the number of sig. figs. and do the calculation. Precision[result] will tell you the number of sig. figs. $\endgroup$
    – Michael E2
    Sep 20, 2020 at 13:47


Your Answer

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

Browse other questions tagged or ask your own question.