Re: real number -> scientific C like string
- To: mathgroup at christensen.cybernetics.net
- Subject: Re: real number -> scientific C like string
- From: Leslie Young <lyoung at chandon.arc.nasa.gov>
- Date: Mon, 24 Oct 1994 11:46:32 -0700
CSciForm[x_] := NumberForm[ N[x],
NumberFormat-> (SequenceForm[#1,"e", #3]& ),
ExponentFunction->Identity ];
Attributes[CSciForm] = {Listable,OneIdentity}
This works on the examples in the e-mail. The NumberFormat trick is
given on p. 352 of the Mathematica book. The attributes let you do
CSciForm[{3.123, 241.}]. I wrap N around x, because the exponent
is always Null for NumberForm of an Integer.
- Leslie Young