I have a function that contains a For loop and sometimes takes several hours to run. It's important that I keep a high precision, and I insert Print statements throughout to check the status. Here is a simplified example:

f[x_] := Block[{$MinPrecision = 500},
    For[i = 0, i < x, i++;
        y = i/2;
        Print[N[y, 10]]

Is there a way to ignore or suppress $MinPrecision when Print is used? I'd like to make the printed output easier to read.

  • 1
    $\begingroup$ Use NumberForm[y, 10] $\endgroup$ – Apple Mar 26 '14 at 15:26
  • $\begingroup$ Perfect. Exactly what I needed. Thanks for your help. $\endgroup$ – tn3rt Mar 26 '14 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.