As specified in documentation center the functions AccountingForm, NumberForm, etc. are useful only to display numbers in different notations: acts as a "wrapper", which affects printing, but not evaluation. But if I want to calculate with less digits how can I do?

For example:

 n1 = 0.2345;
 n2 = 1;
 n2 - n1
n11 = NumberForm[n1, 3];
n2 - n11


Perhaps, sure, I explained not very well my problem. I want that only n1 has 3 decimal. If I use

 NumberForm[{n1, n2 - n1}, 3] 

first I consider all the number with all digits, and then I cut the decimals. I'm I wrong? I'm doing an analysis about how many digits I need in a calculation. All the other number must have 4 digits and only one three digits, so I want to force that number to have three digits


1 Answer 1


The documentation is misleading in this case. The wrapper NumberForm is not transparent to numerical calculation -- it stops it dead. This means you should only apply it to your final calculations when all the numerical work is done. So the following works.

NumberForm[{n1, n2 - n1}, 3]
{0.235, 0.766}

If what you want is for all the numerical work in a notebook to displayed at less than six figures you can change this default value in the Mathematica Preferences dialog or with the Options Inspector.

In Preferences look for 'Displayed precision' in the Appearance > Numbers > Formatting panel.

In the Option Inspector search on PrintPrecision.

When the change in displayed precision is made in Preferences, it affects every notebook. In the Options Inspector you can confine the change to the current notebook if you so wish.

  • $\begingroup$ Of course PrintPrecision can also be set programmatically: SetOptions[EvaluationNotebook[], PrintPrecision -> 10]. $\endgroup$ Aug 24, 2015 at 13:28

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