0
$\begingroup$

I want the result of 1200000000*0.001 to be 1200000.

enter image description here

But Mathematica's output is in the form of scientific counting.

How can I make numbers larger than 1.*10^-8 and smaller than 1.* 10^9 output by scientific counting every time in Mathematica?

For example, for the number 1.231456785*10^6, I want the output to be 1231456.785 every time. It's better to save the settings to the configuration file.

$\endgroup$
2
4
$\begingroup$

Many ways to do this. You could always do

   $PrePrint = AccountingForm;
   1200000000*0.001

Mathematica graphics

Or, if you can change the number of digits

   $PrePrint = AccountingForm[#, 30] &;
   1.231456785*10^6

Mathematica graphics

Look up also number formating.

 1.*10^-8

Mathematica graphics

 1.*10^9

Mathematica graphics

$\endgroup$
3
  • $\begingroup$ For this number, the result of this code does not meet the requirements. Rationalize@1.231456785*10^6 $\endgroup$ – A little mouse on the pampas Apr 9 '20 at 5:42
  • 1
    $\begingroup$ Check carefully the precedence of the operations Mathematica applies in evaluating Rationalize@1.231456785*10^6. It's not clear whether the failure to meet requirements you identify is genuine, or a misunderstanding. $\endgroup$ – High Performance Mark Apr 9 '20 at 11:43
  • $\begingroup$ Thank you very much for your help. I can use the following settings to meet the needs, but after shutting down and restarting MMA, this setting will not work. How can I save it to the configuration file for permanent effect. $PrePrint = ScientificForm[If[10^-5 < # < 10^6, #, N[#]], 15, ExponentFunction -> (If[-6 < # < 6, Null, #] &), DigitBlock -> 4, NumberSeparator -> " "] &; $\endgroup$ – A little mouse on the pampas Apr 10 '20 at 1:32

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.