MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to get 2.334E+6 output form ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg5620] Re: [mg5617] How to get 2.334E+6 output form ?
  • From: xah at best.com (Xah Lee)
  • Date: Sun, 29 Dec 1996 00:56:24 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

 At 11:43 PM 96/12/27, Sergio Rojas wrote:
>How can one tell to Mathematica to write
>                                                                  6
>numbers in the form 2.3456E+6 instead of 2.3456*10^6 (or 2.3456 10 ).
>Also, consider the following:
>...
>{2.744617215013445*10^-15, 2.196710439091517*10^17, 179503.8033995351}
> How the data can be written to a file without the braces and comma in
>between?

I've encountered the same problems before. The following code are pulled
from a program I wrote. It should imply solutions. Especially note the use
of the option ExponentFunction in NumberForm.

data2 = SetPrecision[ Chop[ Flatten[ data2,1], 10^-(exportPrecision+1)],
exportPrecision];
 OpenWrite[fileName];
 WriteString[fileName, "#Converted from Mathematica\n"];
 WriteString[fileName, "#by SaveToRotaterFormat.m\n"];
 WriteString[fileName, "#Xah Lee. (74631.731 at compuserve.com)\n"];
 WriteString[fileName, "#http://www.best.com/~xah/\n";];
 WriteString[ fileName,
  StringReplace[
   ToString@ NumberForm[data2,
    ExponentFunction->(If[-Infinity<#<Infinity,Null,#]&)
   ],
   { "{" -> "",
    "}, " ->StringJoin[ " ", ToString@ colorCode," \n"],
    "}}" -> StringJoin[ " ", ToString@ colorCode," "],
    "," -> " "
   }
  ]
 ];
 Close[fileName]
 ]

 Xah
 xah at best.com; 74631.731 at compuserve.com
 http://www.best.com/~xah/SpecialPlaneCurves_dir/specialPlaneCurves.html
 Mountain View, CA, USA




  • Prev by Date: How to get 2.334E+6 output form ?
  • Next by Date: Re: Weibull Distribution
  • Previous by thread: How to get 2.334E+6 output form ?