2
$\begingroup$

I need to write numbers out to a file without using the scientific notation. How do I tell Mathematica to do that?

This is the code I am using:

ExportString[RandomReal[{0, 10^9}, {1, 5}], "CSV"]
7.554498937472847e8, 8.890561732721748e8, 3.1844080035953116e8, 6.011904915821908e8, 9.281223697983398e8
$\endgroup$
5
$\begingroup$

You can suppress the exponential format as you like with ScientificNotationThreshold, e.g.

NumberForm[#, ScientificNotationThreshold -> {-5, 9}] & /@ 
 RandomReal[{0, 10^9}, {1, 5}]

resp., as you wrote,

ExportString[
 NumberForm[#, ScientificNotationThreshold -> {-5, 9}] & /@ 
  RandomReal[{0, 10^9}, {1, 5}], "CSV"]

delivers:

{580474481., 128820835., 306427380., 712012070., 390581871.}
|improve this answer|||||
$\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.