# How to set the precision for the entire notebook

I want to do various computations conditional on a given precision for the entire notebook. I use the following code:

Block[{$MaxPrecision = 3}, SetPrecision[{"various computations"},3] ]  All of the computations are placed in SetPrecision[{...},3]. The output from the above code seems fine but when I use Enter key then the numbers look as if no precision is applied. Furthermore, how can I override Default Precision with $MaxPrecision=3?

• Could you set the precision of your numerical inputs instead? For instance, if you set initialVariable = 13 then any calculations that involve that value will automatically keep track of the appropriate precision. Commented Nov 29, 2023 at 1:38
• @MarcoB: I have a large matrix mat of numbers. This matrix is used in the computation of variables in the successive steps in the code. How do I set the precision of the matrix mat? Commented Nov 29, 2023 at 1:59
• @MarcoB: There must be an easy way to set the precision for the entire notebook. I need to do that because there are many other computations done in the same notebook. Commented Nov 29, 2023 at 2:01
• SetPrecision[mat, 3] would do it. I don't believe there is a "global precision setting" in the sense you intend. Can you explain a bit more why you think you need it? If you want speed, then machine-precision is your best bet anyway, Commented Nov 29, 2023 at 2:21
• It limits the maximum number of digits of precision used in arbitrary-precision numbers, so that may approximate what you want, but there are some significant caveats. For one, machine-precision calculations are not affected, because they do not use the arbitrary-precision machinery. Secondly, and perhaps more importantly, the docs say that "when \$MaxPrecision` is set, some computations may not get correct results" because a higher precision than requested would be required to obtain the correct result. The latter drawback would be a show-stopper to me. Commented Nov 29, 2023 at 18:05