I have some random number x. It can be 222.1245646 or 3.141562652. How should I show this number to 5 decimal numbers ? I cant use this:

N[x, 5] because it shows 5 digits(222.12 or 3.1415).


1 Answer 1


Use NumberForm[].

This will display number 1.2345678 with 3 precise digits and 4 digits to the right of the decimal:

NumberForm[1.2345678, {3, 4}]


You can adjust the second argument to suit your needs. Maybe like this:

NumberForm[1.2345678, {99, 5}]


7 is at the end instead of 6 because of rounding.


Your Answer

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

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