1
$\begingroup$

I have a couple of complicated user-defined functions, one which calls the other, and I wish to control the number of decimal places displayed when I call the "mother" function. I have tried the obvious

N[mother[],n]

but no matter the choice for n I receive only 6 decimal places. But when I write a simple nested function like

f[x_] := Module[{}, x/3];
g[x_] := Module[{}, f[x]];

and then call

N[g[1], 50]

I receive the requested number of digits (so it doesn't seem to be the nesting causing the issue). Unfortunately I cannot post the actual functions I am playing with due to their size. Any ideas would be appreciated...

$\endgroup$

1 Answer 1

2
$\begingroup$

I believe this question is a combination of these:

Specifically, for your function to work as desired most directly (and correctly) it will need to return a number or expression in arbitrary precision. This is (best) done by using arbitrary precision or exact numbers throughout the computation.

Alternately you can use NumberForm to display your output rather than N.

The result can be forced with SetAccuracy with the understanding that your results are fake. See:

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.