I have a lot of data to inspect. An example of a number in my program is


This gets displayed as


Unfortunately, most of my information is in the small digits, so, when visually inspecting this data, 123.189094 and 123.189263 are not distinguishable, in other words, a list like

{123.189094, 123.189263}

is displayed like

{123.189, 123.189}

and it looks like I have equal data when I don't. The only fix I have found for this is FullForm, but that explodes out all the structure (lists, rules, etc.) and makes the display very annoying. Imagine that my data were actually buried deep in some nested structure of lists and rules (and it is).

{123.189094, 123.189263}//FullForm
(* List[123.189094`,123.189263`] *)

is not what I want. I would have thought N[#,10]& or somesuch would work, but it doesn't

{123.189094, 123.189263} // N[#, 10] &
(* {123.189,123.189} AAACH! *)

StandardForm doesn't do it, TraditionalForm doesn't do it.

I'm stuck. As usual, will be grateful for any advice or ideas.

  • 1
    $\begingroup$ Related: Mathematica Precision $\endgroup$ – Brett Champion Mar 30 '12 at 23:16
  • 6
    $\begingroup$ It is possible to set the number of digits in Preferences->Appearance->Numbers->Formatting $\endgroup$ – Andrew Mar 31 '12 at 7:34

Maybe this :

NumberForm[#, 10] &@ {123.189094`, 123.189263`}
{123.189094, 123.189263 }



Consider also this utility of NumberForm[ x, {m, k}] giving m real digits of x with k digits to the right of the decimal point, e.g.

NumberForm[#, {10, 7}] &@ { 197.9898987322333, 201.73205080756887 }
{ 197.9898987, 201.7320508 }
  • $\begingroup$ But if I have a list of numbers, after applying NumberForm, I can't access the list elements as usual, but with an extra index, for example what was before mylist[[1]] is now mylist[[1]][[1]]. How can avoid this? I need to pass this list to a function. $\endgroup$ – Santi Apr 24 '14 at 10:09
  • $\begingroup$ I would make it like this f[ NumberForm[#, {10, 7}]& @ list]. $\endgroup$ – Artes Apr 24 '14 at 10:55
  • $\begingroup$ Sorry @Artes, but that still doesn't work. NumberForm returns something that has not the same structure as my original list. Using First[NumberForm[#, {10, 7}]& @ list] returns something that still has other structure, with a list . And then if I do First[First[NumberForm[#, {10, 7}]& @ list]] it returns only a list with the original "old" precision digits. $\endgroup$ – Santi Apr 29 '14 at 16:18
  • $\begingroup$ @Santi If you have some problems you should ask another question checking if there is no one similar. Here I solved the OP problem. Why should I bother some unclear questions? I believe you would rather use something different but there is no precise information. Perhaps you should check RootApproximant or with the second argument Rationalize or Chop or Round or ... $\endgroup$ – Artes Apr 29 '14 at 17:10

If this is something you want in general, try:

SetOptions[$FrontEnd, PrintPrecision-> 10]

and if you just want it for a specific notebook, then do:

SetOptions[InputNotebook[], PrintPrecision-> 10]
  • 2
    $\begingroup$ I have just seen that this was asked again. As this is a question which presumably beginners are asking I think it would make sense to mention that you can change that setting in the "Preferences" dialog (menu entry "Edit" -> "Preferences") in the Numbers tab of the Appearance tab... $\endgroup$ – Albert Retey Jan 18 '16 at 17:44


You can control the number of digits displayed using the PrintPrecision option.

You have a number of options for its use. You can set it Globally or for the specific Notebook using the Options Inspector. You can also use it directly with Style:

Style[123.189094, PrintPrecision -> 10]

You can set it temporarily for one session like this:

SetOptions[$FrontEndSession, PrintPrecision -> 10]

Finally you can set it using Style Sheets (select cell type Output).

Arbitrary precision arithmetic

If you use arbitrary precision arithmetic Mathematica automatically displays all digits. If you are concerned with the small end of numbers you should probably be using arbitrary precision anyway. Please see the second half of this answer for more.

  • $\begingroup$ No upvotes? I'll help you play ketchup. You and @RolfMertig. These are the answers, the other's are (some good) workarounds. It's not a question about precision and there's no need to wrap the result in some inert structure only for the FE to hide less of what it already received from the kernel $\endgroup$ – Rojo Mar 31 '12 at 6:22
  • $\begingroup$ @Rojo thanks. By the way, please see my updated "Splitting" answer (the first one). I'm still chasing the perfection of doing it with a single pattern, but Mathematica is not yielding easily. $\endgroup$ – Mr.Wizard Mar 31 '12 at 6:59

Use NumberForm:

NumberForm[{123.189094, 123.189263}, 9]

The other answers are fine, but if all the interest is in the small-end digits, consider something like:

((RealDigits /@ {123.189094`, 123.189263`}) /. 
  {a__, 0..} -> {a})[[All, 1, -4 ;; -1]]
{{9, 0, 9, 4}, {9, 2, 6, 3}}

This picks up the smallest-end non-zero digits so you can focus on them. This won't work if your numbers have a different number of digits. If that's the case, you will have to allow for this by instead dropping the first few digits from the RealDigits results and then removing the trailing zeros.

(RealDigits /@ {123.189094`, 123.189263`})[[All, 1, 5 ;; -1]] /. 
  {a__, 0 ..} -> {a}// TableForm
 8  9   0   9   4
 8  9   2   6   3

InputForm gives

  {123.189094, 123.189263} // InputForm
  (*==> {123.189094, 123.189263}  *)

Your Answer

