# How to enforce numerical precision throughout a package

I developed a big package that does quite a bit of numerics. Is there a way to enforce that all numerical computations are done with a pre-defined accuracy? For example, can one use something like SetAccuracy[...] in the beginning of the package and then all functions automatically use that accuracy. Of course, one can wrap all functions with N[], but I wonder if that can be avoided.

EDIT: As an example, I tried changing

BeginPackage["packageName"];
...


into

BeginPackage["packageName"];
$MaxPrecision=10; ...  but I noticed that the computations are still done with unlimited precision (unless N[] is used to wrap expressions). • Well, maybe. But this is not how Mathematica is meant to work and I would question whether it is a good idea to have a package that relies on a non-standard use of numerics. Can you give an example that shows your use case more clearly? – Oleksandr R. Mar 26 '14 at 11:18 • (Also, your $MaxPrecision is by no means localized to the package, so this will be problematic for the user.) – Oleksandr R. Mar 26 '14 at 11:23
• I understanding your point. I know that Mathematica is meant to work as it does. However, the question is not about that. In fact, one should be able to use it to solve heavy numerical problems, and I am doing that frequently. The example you seek is way too big to be listed here, but I can simplify. Imagine a piece of code that evolves a network of electronic elements. Basically an ODE system that needs to be solved numerically. Of course, I am doing it in a very specific way so I cannot really use built in ODE solver. The point is, well, as the question states. – zorank Mar 26 '14 at 11:52
• Okay. And you need to do it in fixed precision why exactly? Is it for performance or algorithmic reasons? – Oleksandr R. Mar 26 '14 at 14:57
• I understood that you've already written the package. But to say it bluntly, what you're asking for (restriction to fixed precision numerical arithmetic only, localized to a specific package) is simply impossible in the abstract, because Mathematica does not support that, even at a conceptual level. To give people a chance of suggesting an implementation that works for you, it would be necessary for you to give at least some concrete detail about the structure of your package and the numerical requirements of your calculations. I understand this must be getting frustrating for you, but I ... – Oleksandr R. Mar 28 '14 at 11:22