Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have tried to resolve the problem of the following link How can I solve precision problem

I can tell the problem described in that link shortly here, It's no mater how many precision is there after decimal(.) the result should be 2 or 3 precision after decimal as per user requirement.e.g


Output should be as per user wish precision as 2.


There I found NumberForm[] function as a solution, since the NumberForm[] function is wrap up the result, I can't get the result as number out of it.

I tried like this

NumberForm[3, {4, 2}]

Output am getting is


But when I try to do further operation, it's not computing

NumberForm[N[10/3], {4, 2}] + 1
NumberForm[3, {4, 2}] + 1



I tried other way also which follows

ToExpression[ToString[NumberForm[3, {4, 2}]]]



but I need output as 3.00. Help me to find the solution.

share|improve this question

Is SetAccuracy what you want?

a = N[10/3, {∞, 3}]


b = 3``3


a + 1


b + 1




Please note Accuracy is a different concept from Precision.

share|improve this answer

Use the $PrePrint global parameter:

$PrePrint = If[MatchQ[#, _?NumericQ], NumberForm[#, {4, 2}], #] &;

Note: if you dont want the way rationals will be represented after setting the global variable (e.g. $3.00/4.00$) then use this instead

$PrePrint = If[MatchQ[#, Except[_Rational,_?NumericQ]], NumberForm[#, {4, 2}], #] &;


if you just want it for the InputField command try this instead

InputField[Dynamic[ToString@NumberForm[b, {4, 2}]], String]
share|improve this answer
I have problem with your answer, I need to give the result to InputField the output I got is not I expected.b=3 InputField[Dynamic[b], Number]. I got result 3 alone in InputField not 3.00 – niren Apr 24 '13 at 9:59
@niren Indeed but you didn't ask that ... – Spawn1701D Apr 24 '13 at 10:06
@niren This is closer to what you really want: InputField[Dynamic[ToString@NumberForm[b, {4, 2}]], String] – Spawn1701D Apr 24 '13 at 10:11
I want only Number in InputField, Since the result from the InputField will go for further calculation. – niren Apr 24 '13 at 10:16
@niren but inside the input field you cant do any calculations just input a number. You have to explain exactly what you want. – Spawn1701D Apr 24 '13 at 10:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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