0
$\begingroup$

On the question Way to improve "show me this decimal number to M places, don't use scientific notation"? I learned how to automatically not use scientific notation with:

format[x_Real] := NumberForm[x, ExponentFunction -> (Null &)];
format[x_] := x;
$Post = format;

Then my numbers are outputting better than before as :

4096^2*12*3.6`20
724775731.20000000000

But it is missing the miliar separator as comma ,. For example, the number 724775731.20000000000 should output as 724,775,731.20000000000 so I can understand it easily.

Can the output the show as 724,775,731.20000000000 instead of 724775731.20000000000?


Related:

  1. https://en.wikipedia.org/wiki/Decimal_mark
$\endgroup$
  • 1
    $\begingroup$ Look up the DigitBlock and NumberSeparator options. Do read the whole doc page for NumberForm[] while you're at it. $\endgroup$ – J. M. will be back soon Sep 4 '17 at 15:28
  • 2
    $\begingroup$ Take a look at Preferences -> Appearance -> Numbers -> Formatting. $\endgroup$ – Szabolcs Sep 4 '17 at 15:37
2
$\begingroup$

Thanks to the comments, I find out how to set it automatically to ` option:

format[x_Real]:=NumberForm[x,ExponentFunction->(Null&),DigitBlock->3,NumberSeparator->","];
format[x_]:=x;
$Post=format;

Now these:

4096^2*12*3.6`10
4096^3`20

Outputs as:

724,775,731.2
68,719,476,736.000,000,0
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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